diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e0e9873337f95535b8808377d7381035783b4dda..caa99d4b089b3a8d9316c9b574fce30b3fdd1fac 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -51,6 +51,7 @@ $dirins = $tmp[0]; $FILEFLAG='modulebuilder.txt'; +$now=dol_now(); /* * Actions @@ -106,7 +107,7 @@ if ($dirins && $action == 'initmodule' && $modulename) // Edit PHP files if (! $error) { - $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js)$', '', 'fullname', SORT_ASC, 0, 1); + $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); foreach($listofphpfilestoedit as $phpfileval) { //var_dump($phpfileval['fullname']); @@ -116,7 +117,8 @@ if ($dirins && $action == 'initmodule' && $modulename) 'MYMODULE'=>strtoupper($modulename), 'My module'=>$modulename, 'htdocs/modulebuilder/template/'=>'', - ); + '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); diff --git a/htdocs/modulebuilder/template/admin/about.php b/htdocs/modulebuilder/template/admin/about.php index d73fa237b88b448d0b38c746805758a1d2193e57..43194ad23e933e520687f86ed2a36440cd02aba5 100644 --- a/htdocs/modulebuilder/template/admin/about.php +++ b/htdocs/modulebuilder/template/admin/about.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 9e9dbdaf1ac5814208448eaa9e2798e95ac11006..79d761b3297b592de5f9f7417b1eeba85825084b 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index c6ebcae40e8ce4075f2253ac654e818dd8f0a125..b8b43f1359d7707efce5605e8b6729bad362eb02 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/class/api_myobject.class.php b/htdocs/modulebuilder/template/class/api_myobject.class.php index 7f5ee413892574ceafa2b23feef72be8a8d21705..44e2dd2fcc4ce039b63d9749c7caa39a76379857 100644 --- a/htdocs/modulebuilder/template/class/api_myobject.class.php +++ b/htdocs/modulebuilder/template/class/api_myobject.class.php @@ -1,5 +1,6 @@ <?php /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> + * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,18 +23,18 @@ use Luracast\Restler\RestException; * \ingroup mymodule * \brief File for API management of myobject. */ - + /** * API class for mymodule myobject * * @smart-auto-routing false - * @access protected + * @access protected * @class DolibarrApiAccess {@requires user,external} */ class MyObjectApi extends DolibarrApi { /** - * @var array $FIELDS Mandatory fields, checked when create and update object + * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( 'name' @@ -48,7 +49,7 @@ class MyObjectApi extends DolibarrApi * Constructor * * @url GET myobject/ - * + * */ function __construct() { @@ -64,21 +65,21 @@ class MyObjectApi extends DolibarrApi * * @param int $id ID of myobject * @return array|mixed data without useless information - * + * * @url GET myobject/{id} * @throws RestException */ function get($id) - { + { if(! DolibarrApiAccess::$user->rights->myobject->read) { throw new RestException(401); } - + $result = $this->myobject->fetch($id); if( ! $result ) { throw new RestException(404, 'MyObject not found'); } - + if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -88,9 +89,9 @@ class MyObjectApi extends DolibarrApi /** * List myobjects - * + * * Get a list of myobjects - * + * * @param int $mode Use this param to filter list * @param string $sortfield Sort field * @param string $sortorder Sort order @@ -103,22 +104,22 @@ class MyObjectApi extends DolibarrApi */ function index($mode, $sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') { global $db, $conf; - + $obj_ret = array(); - + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; - + // If the internal user must only see his customers, force searching by him if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT s.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."myobject as s"; - + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " WHERE s.fk_stcomm = st.id"; - + // Example of use $mode //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; @@ -175,13 +176,13 @@ class MyObjectApi extends DolibarrApi } return $obj_ret; } - + /** * Create myobject object * * @param array $request_data Request datas * @return int ID of myobject - * + * * @url POST myobject/ */ function post($request_data = NULL) @@ -191,7 +192,7 @@ class MyObjectApi extends DolibarrApi } // Check mandatory fields $result = $this->_validate($request_data); - + foreach($request_data as $field => $value) { $this->myobject->$field = $value; } @@ -205,9 +206,9 @@ class MyObjectApi extends DolibarrApi * Update myobject * * @param int $id Id of myobject to update - * @param array $request_data Datas - * @return int - * + * @param array $request_data Datas + * @return int + * * @url PUT myobject/{id} */ function put($id, $request_data = NULL) @@ -215,12 +216,12 @@ class MyObjectApi extends DolibarrApi if(! DolibarrApiAccess::$user->rights->myobject->create) { throw new RestException(401); } - + $result = $this->myobject->fetch($id); if( ! $result ) { throw new RestException(404, 'MyObject not found'); } - + if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -228,19 +229,19 @@ class MyObjectApi extends DolibarrApi foreach($request_data as $field => $value) { $this->myobject->$field = $value; } - + if($this->myobject->update($id, DolibarrApiAccess::$user)) return $this->get ($id); - + return false; } - + /** * Delete myobject * * @param int $id MyObject ID * @return array - * + * * @url DELETE myobject/{id} */ function delete($id) @@ -252,31 +253,31 @@ class MyObjectApi extends DolibarrApi if( ! $result ) { throw new RestException(404, 'MyObject not found'); } - + if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - + if( !$this->myobject->delete($id)) { throw new RestException(500); } - + return array( 'success' => array( 'code' => 200, 'message' => 'MyObject deleted' ) ); - + } - + /** * Validate fields before create or update object - * + * * @param array $data Data to validate * @return array - * + * * @throws RestException */ function _validate($data) diff --git a/htdocs/modulebuilder/template/core/boxes/mybox.php b/htdocs/modulebuilder/template/core/boxes/mybox.php index 7200d07559acfcdfe549223fb5fdf57b48bcc07e..a02d041130d3b3f998227d3a129a7a7cd4b655aa 100644 --- a/htdocs/modulebuilder/template/core/boxes/mybox.php +++ b/htdocs/modulebuilder/template/core/boxes/mybox.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 60889bdf279d387837ad4fdb3b47e318d85d1c8e..8b283d1d695daf77fdd7d86f1f6ac1b6465dd075 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -1,7 +1,6 @@ <?php -/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com> +/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/css/mymodule.css.php b/htdocs/modulebuilder/template/css/mymodule.css.php index 3722fc1e06e9ef6d92f8de09eb4d80d9f82cc358..e010bbfe920a2fdf289012f1f168a1fa6e241a9a 100644 --- a/htdocs/modulebuilder/template/css/mymodule.css.php +++ b/htdocs/modulebuilder/template/css/mymodule.css.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/js/mymodule.js.php b/htdocs/modulebuilder/template/js/mymodule.js.php index 2d6a940c3737dc29fe5af228f679edc371469366..122b39786312c6ac07fab023aa56a5386df7411a 100644 --- a/htdocs/modulebuilder/template/js/mymodule.js.php +++ b/htdocs/modulebuilder/template/js/mymodule.js.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang index c33f2453fc43f54f527900793dc474738e20f3f1..478d589a7e631f7cddfd8771a3ebb54ca63f8c89 100644 --- a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang +++ b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang @@ -1,5 +1,4 @@ -# <one line to give the program's name and a brief idea of what it does.> -# Copyright (C) <year> <name of author> +# Copyright (C) ---Put here your own copyright and developer email--- # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang b/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang index 06e7ba3388524cc0cb9bedf5c5cc3b8fc80b4eb6..c946ad6691ca8e0e6f01b7daea1f928f1462256c 100644 --- a/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang +++ b/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang @@ -1,5 +1,4 @@ -# <one line to give the program's name and a brief idea of what it does.> -# Copyright (C) <year> <name of author> +# Copyright (C) ---Put here your own copyright and developer email--- # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/lib/mymodule.lib.php b/htdocs/modulebuilder/template/lib/mymodule.lib.php index ac4e0bf4a669dabbdf211a0ad99391fdf358a3f0..3c88bcdea67812874a861936f37154c7b7bc1827 100644 --- a/htdocs/modulebuilder/template/lib/mymodule.lib.php +++ b/htdocs/modulebuilder/template/lib/mymodule.lib.php @@ -1,6 +1,5 @@ <?php -/* <one line to give the program's name and a brief idea of what it does.> - * Copyright (C) <year> <name of author> +/* Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql index 9f1c8c20ea21f13bf5967733585c8f85ecf69f5c..812a98090afa61b61f859cc459a11b6e342a7604 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql @@ -1,5 +1,4 @@ --- <one line to give the program's name and a brief idea of what it does.> --- Copyright (C) <year> <name of author> +-- Copyright (C) ---Put here your own copyright and developer email--- -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.sql b/htdocs/modulebuilder/template/sql/llx_myobject.sql index edcd7a7c26dcac4749159100d6a50d9ca16cbdca..8cba239766f15e0abdae9c4bcb57eacfb369f6d1 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.sql @@ -1,5 +1,4 @@ --- <one line to give the program's name and a brief idea of what it does.> --- Copyright (C) <year> <name of author> +-- Copyright (C) ---Put here your own copyright and developer email--- -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql index 6d5bb8155b1add00374be2aa85bcfbbdc382873d..494de5a2b1762a0d9ceaa5d94f57abc3436cf755 100644 --- a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql +++ b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql @@ -1,5 +1,4 @@ --- <one line to give the program's name and a brief idea of what it does.> --- Copyright (C) <year> <name of author> +-- Copyright (C) ---Put here your own copyright and developer email--- -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by