@@ -31,31 +31,31 @@ |
||
31 | 31 | */ |
32 | 32 | abstract class ModeleBankAccountDoc extends CommonDocGenerator |
33 | 33 | { |
34 | - /** |
|
35 | - * @var string Error code (or message) |
|
36 | - */ |
|
37 | - public $error=''; |
|
34 | + /** |
|
35 | + * @var string Error code (or message) |
|
36 | + */ |
|
37 | + public $error=''; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
41 | - /** |
|
42 | - * Return list of active generation modules |
|
43 | - * |
|
41 | + /** |
|
42 | + * Return list of active generation modules |
|
43 | + * |
|
44 | 44 | * @param DoliDB $db Database handler |
45 | 45 | * @param integer $maxfilenamelength Max length of value to show |
46 | 46 | * @return array List of templates |
47 | 47 | */ |
48 | - static function liste_modeles($db, $maxfilenamelength=0) |
|
49 | - { |
|
48 | + static function liste_modeles($db, $maxfilenamelength=0) |
|
49 | + { |
|
50 | 50 | // phpcs:enable |
51 | - global $conf; |
|
51 | + global $conf; |
|
52 | 52 | |
53 | - $type = 'bankaccount'; |
|
54 | - $list = array(); |
|
53 | + $type = 'bankaccount'; |
|
54 | + $list = array(); |
|
55 | 55 | |
56 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
57 | - $list = getListOfModels($db, $type, $maxfilenamelength); |
|
56 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
57 | + $list = getListOfModels($db, $type, $maxfilenamelength); |
|
58 | 58 | |
59 | - return $list; |
|
60 | - } |
|
59 | + return $list; |
|
60 | + } |
|
61 | 61 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var string Error code (or message) |
36 | 36 | */ |
37 | - public $error=''; |
|
37 | + public $error = ''; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param integer $maxfilenamelength Max length of value to show |
46 | 46 | * @return array List of templates |
47 | 47 | */ |
48 | - static function liste_modeles($db, $maxfilenamelength=0) |
|
48 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
49 | 49 | { |
50 | 50 | // phpcs:enable |
51 | 51 | global $conf; |
@@ -36,257 +36,257 @@ |
||
36 | 36 | class modPropale extends DolibarrModules |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
41 | - * |
|
42 | - * @param DoliDB $db Database handler |
|
43 | - */ |
|
44 | - function __construct($db) |
|
45 | - { |
|
46 | - global $conf, $user; |
|
47 | - |
|
48 | - $this->db = $db; |
|
49 | - $this->numero = 20; |
|
50 | - |
|
51 | - $this->family = "crm"; |
|
52 | - $this->module_position = '20'; |
|
53 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
54 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | - $this->description = "Gestion des propositions commerciales"; |
|
56 | - |
|
57 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | - $this->version = 'dolibarr'; |
|
59 | - |
|
60 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
61 | - $this->picto='propal'; |
|
62 | - |
|
63 | - // Data directories to create when module is enabled |
|
64 | - $this->dirs = array("/propale/temp"); |
|
65 | - |
|
66 | - // Dependencies |
|
67 | - $this->hidden = false; // A condition to hide module |
|
68 | - $this->depends = array("modSociete"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
72 | - $this->config_page_url = array("propal.php"); |
|
73 | - $this->langfiles = array("propal","bills","companies","deliveries","products"); |
|
74 | - |
|
75 | - // Constants |
|
76 | - $this->const = array(); |
|
77 | - $r=0; |
|
78 | - |
|
79 | - $this->const[$r][0] = "PROPALE_ADDON_PDF"; |
|
80 | - $this->const[$r][1] = "chaine"; |
|
81 | - $this->const[$r][2] = "azur"; |
|
82 | - $this->const[$r][3] = 'Name of the proposal generation manager in PDF format'; |
|
83 | - $this->const[$r][4] = 0; |
|
84 | - $r++; |
|
85 | - |
|
86 | - $this->const[$r][0] = "PROPALE_ADDON"; |
|
87 | - $this->const[$r][1] = "chaine"; |
|
88 | - $this->const[$r][2] = "mod_propale_marbre"; |
|
89 | - $this->const[$r][3] = 'Name of proposal numbering manager'; |
|
90 | - $this->const[$r][4] = 0; |
|
91 | - $r++; |
|
92 | - |
|
93 | - $this->const[$r][0] = "PROPALE_VALIDITY_DURATION"; |
|
94 | - $this->const[$r][1] = "chaine"; |
|
95 | - $this->const[$r][2] = "15"; |
|
96 | - $this->const[$r][3] = 'Duration of validity of business proposals'; |
|
97 | - $this->const[$r][4] = 0; |
|
98 | - $r++; |
|
99 | - |
|
100 | - $this->const[$r][0] = "PROPALE_ADDON_PDF_ODT_PATH"; |
|
101 | - $this->const[$r][1] = "chaine"; |
|
102 | - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/proposals"; |
|
103 | - $this->const[$r][3] = ""; |
|
104 | - $this->const[$r][4] = 0; |
|
105 | - $r++; |
|
106 | - |
|
107 | - /*$this->const[$r][0] = "PROPALE_DRAFT_WATERMARK"; |
|
39 | + /** |
|
40 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
41 | + * |
|
42 | + * @param DoliDB $db Database handler |
|
43 | + */ |
|
44 | + function __construct($db) |
|
45 | + { |
|
46 | + global $conf, $user; |
|
47 | + |
|
48 | + $this->db = $db; |
|
49 | + $this->numero = 20; |
|
50 | + |
|
51 | + $this->family = "crm"; |
|
52 | + $this->module_position = '20'; |
|
53 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
54 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | + $this->description = "Gestion des propositions commerciales"; |
|
56 | + |
|
57 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | + $this->version = 'dolibarr'; |
|
59 | + |
|
60 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
61 | + $this->picto='propal'; |
|
62 | + |
|
63 | + // Data directories to create when module is enabled |
|
64 | + $this->dirs = array("/propale/temp"); |
|
65 | + |
|
66 | + // Dependencies |
|
67 | + $this->hidden = false; // A condition to hide module |
|
68 | + $this->depends = array("modSociete"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
72 | + $this->config_page_url = array("propal.php"); |
|
73 | + $this->langfiles = array("propal","bills","companies","deliveries","products"); |
|
74 | + |
|
75 | + // Constants |
|
76 | + $this->const = array(); |
|
77 | + $r=0; |
|
78 | + |
|
79 | + $this->const[$r][0] = "PROPALE_ADDON_PDF"; |
|
80 | + $this->const[$r][1] = "chaine"; |
|
81 | + $this->const[$r][2] = "azur"; |
|
82 | + $this->const[$r][3] = 'Name of the proposal generation manager in PDF format'; |
|
83 | + $this->const[$r][4] = 0; |
|
84 | + $r++; |
|
85 | + |
|
86 | + $this->const[$r][0] = "PROPALE_ADDON"; |
|
87 | + $this->const[$r][1] = "chaine"; |
|
88 | + $this->const[$r][2] = "mod_propale_marbre"; |
|
89 | + $this->const[$r][3] = 'Name of proposal numbering manager'; |
|
90 | + $this->const[$r][4] = 0; |
|
91 | + $r++; |
|
92 | + |
|
93 | + $this->const[$r][0] = "PROPALE_VALIDITY_DURATION"; |
|
94 | + $this->const[$r][1] = "chaine"; |
|
95 | + $this->const[$r][2] = "15"; |
|
96 | + $this->const[$r][3] = 'Duration of validity of business proposals'; |
|
97 | + $this->const[$r][4] = 0; |
|
98 | + $r++; |
|
99 | + |
|
100 | + $this->const[$r][0] = "PROPALE_ADDON_PDF_ODT_PATH"; |
|
101 | + $this->const[$r][1] = "chaine"; |
|
102 | + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/proposals"; |
|
103 | + $this->const[$r][3] = ""; |
|
104 | + $this->const[$r][4] = 0; |
|
105 | + $r++; |
|
106 | + |
|
107 | + /*$this->const[$r][0] = "PROPALE_DRAFT_WATERMARK"; |
|
108 | 108 | $this->const[$r][2] = "__(Draft)__"; |
109 | 109 | $this->const[$r][3] = 'Watermark to show on draft proposals'; |
110 | 110 | $this->const[$r][4] = 0; |
111 | 111 | $r++;*/ |
112 | 112 | |
113 | - // Boxes |
|
114 | - $this->boxes = array( |
|
115 | - 0=>array('file'=>'box_graph_propales_permonth.php','enabledbydefaulton'=>'Home'), |
|
116 | - 1=>array('file'=>'box_propales.php','enabledbydefaulton'=>'Home'), |
|
117 | - ); |
|
118 | - |
|
119 | - // Permissions |
|
120 | - $this->rights = array(); |
|
121 | - $this->rights_class = 'propale'; |
|
122 | - $r=0; |
|
123 | - |
|
124 | - $r++; |
|
125 | - $this->rights[$r][0] = 21; // id de la permission |
|
126 | - $this->rights[$r][1] = 'Read commercial proposals'; // libelle de la permission |
|
127 | - $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
128 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
129 | - $this->rights[$r][4] = 'lire'; |
|
130 | - |
|
131 | - $r++; |
|
132 | - $this->rights[$r][0] = 22; // id de la permission |
|
133 | - $this->rights[$r][1] = 'Create and update commercial proposals'; // libelle de la permission |
|
134 | - $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) |
|
135 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
136 | - $this->rights[$r][4] = 'creer'; |
|
137 | - |
|
138 | - $r++; |
|
139 | - $this->rights[$r][0] = 24; // id de la permission |
|
140 | - $this->rights[$r][1] = 'Validate commercial proposals'; // libelle de la permission |
|
141 | - $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
142 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
143 | - $this->rights[$r][4] = 'propal_advance'; |
|
144 | - $this->rights[$r][5] = 'validate'; |
|
145 | - |
|
146 | - $r++; |
|
147 | - $this->rights[$r][0] = 25; // id de la permission |
|
148 | - $this->rights[$r][1] = 'Send commercial proposals to customers'; // libelle de la permission |
|
149 | - $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
150 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
151 | - $this->rights[$r][4] = 'propal_advance'; |
|
113 | + // Boxes |
|
114 | + $this->boxes = array( |
|
115 | + 0=>array('file'=>'box_graph_propales_permonth.php','enabledbydefaulton'=>'Home'), |
|
116 | + 1=>array('file'=>'box_propales.php','enabledbydefaulton'=>'Home'), |
|
117 | + ); |
|
118 | + |
|
119 | + // Permissions |
|
120 | + $this->rights = array(); |
|
121 | + $this->rights_class = 'propale'; |
|
122 | + $r=0; |
|
123 | + |
|
124 | + $r++; |
|
125 | + $this->rights[$r][0] = 21; // id de la permission |
|
126 | + $this->rights[$r][1] = 'Read commercial proposals'; // libelle de la permission |
|
127 | + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
128 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
129 | + $this->rights[$r][4] = 'lire'; |
|
130 | + |
|
131 | + $r++; |
|
132 | + $this->rights[$r][0] = 22; // id de la permission |
|
133 | + $this->rights[$r][1] = 'Create and update commercial proposals'; // libelle de la permission |
|
134 | + $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) |
|
135 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
136 | + $this->rights[$r][4] = 'creer'; |
|
137 | + |
|
138 | + $r++; |
|
139 | + $this->rights[$r][0] = 24; // id de la permission |
|
140 | + $this->rights[$r][1] = 'Validate commercial proposals'; // libelle de la permission |
|
141 | + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
142 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
143 | + $this->rights[$r][4] = 'propal_advance'; |
|
144 | + $this->rights[$r][5] = 'validate'; |
|
145 | + |
|
146 | + $r++; |
|
147 | + $this->rights[$r][0] = 25; // id de la permission |
|
148 | + $this->rights[$r][1] = 'Send commercial proposals to customers'; // libelle de la permission |
|
149 | + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
150 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
151 | + $this->rights[$r][4] = 'propal_advance'; |
|
152 | 152 | $this->rights[$r][5] = 'send'; |
153 | 153 | |
154 | - $r++; |
|
155 | - $this->rights[$r][0] = 26; // id de la permission |
|
156 | - $this->rights[$r][1] = 'Close commercial proposals'; // libelle de la permission |
|
157 | - $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
158 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
159 | - $this->rights[$r][4] = 'cloturer'; |
|
160 | - |
|
161 | - $r++; |
|
162 | - $this->rights[$r][0] = 27; // id de la permission |
|
163 | - $this->rights[$r][1] = 'Delete commercial proposals'; // libelle de la permission |
|
164 | - $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
165 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
166 | - $this->rights[$r][4] = 'supprimer'; |
|
167 | - |
|
168 | - $r++; |
|
169 | - $this->rights[$r][0] = 28; // id de la permission |
|
170 | - $this->rights[$r][1] = 'Exporting commercial proposals and attributes'; // libelle de la permission |
|
171 | - $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
172 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
173 | - $this->rights[$r][4] = 'export'; |
|
174 | - |
|
175 | - |
|
176 | - // Menus |
|
177 | - //------- |
|
178 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
179 | - |
|
180 | - |
|
181 | - // Exports |
|
182 | - //-------- |
|
183 | - $r=0; |
|
184 | - |
|
185 | - $r++; |
|
186 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
187 | - $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
188 | - $this->export_permission[$r]=array(array("propale","export")); |
|
189 | - $this->export_fields_array[$r]=array( |
|
190 | - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone', |
|
191 | - 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer", |
|
192 | - 'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount", |
|
193 | - 'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate', |
|
194 | - 'c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', |
|
195 | - 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct', |
|
196 | - 'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC", |
|
197 | - 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel' |
|
198 | - ); |
|
199 | - //$this->export_TypeFields_array[$r]=array( |
|
200 | - // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text', |
|
201 | - // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date", |
|
202 | - // 'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text", |
|
203 | - // 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", |
|
204 | - // 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' |
|
205 | - //); |
|
206 | - $this->export_TypeFields_array[$r]=array( |
|
207 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text', |
|
208 | - 's.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date", |
|
209 | - 'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date', |
|
210 | - 'pj.ref'=>'Text', 'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", |
|
211 | - 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text' |
|
212 | - ); |
|
213 | - $this->export_entities_array[$r]=array( |
|
214 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company', |
|
215 | - 's.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal", |
|
216 | - 'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal", |
|
217 | - 'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', |
|
218 | - 'cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line", |
|
219 | - 'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product' |
|
220 | - ); |
|
221 | - $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
222 | - $keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra'; |
|
223 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
224 | - $keyforselect='propaldet'; $keyforelement='propal_line'; $keyforaliasextra='extra2'; |
|
225 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
226 | - $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; |
|
227 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
228 | - $keyforselect='societe'; $keyforelement='societe'; $keyforaliasextra='extra4'; |
|
229 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
230 | - |
|
231 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
232 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; |
|
233 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; |
|
234 | - |
|
235 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
236 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
237 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; |
|
238 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid'; |
|
239 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; |
|
240 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; |
|
241 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; |
|
242 | - $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'propaldet as cd'; |
|
243 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet_extrafields as extra2 on cd.rowid = extra2.fk_object'; |
|
244 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; |
|
245 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; |
|
246 | - $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; |
|
247 | - $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('propal').')'; |
|
248 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - /** |
|
253 | - * Function called when module is enabled. |
|
254 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
255 | - * It also creates data directories |
|
256 | - * |
|
154 | + $r++; |
|
155 | + $this->rights[$r][0] = 26; // id de la permission |
|
156 | + $this->rights[$r][1] = 'Close commercial proposals'; // libelle de la permission |
|
157 | + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
158 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
159 | + $this->rights[$r][4] = 'cloturer'; |
|
160 | + |
|
161 | + $r++; |
|
162 | + $this->rights[$r][0] = 27; // id de la permission |
|
163 | + $this->rights[$r][1] = 'Delete commercial proposals'; // libelle de la permission |
|
164 | + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
165 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
166 | + $this->rights[$r][4] = 'supprimer'; |
|
167 | + |
|
168 | + $r++; |
|
169 | + $this->rights[$r][0] = 28; // id de la permission |
|
170 | + $this->rights[$r][1] = 'Exporting commercial proposals and attributes'; // libelle de la permission |
|
171 | + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
172 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
173 | + $this->rights[$r][4] = 'export'; |
|
174 | + |
|
175 | + |
|
176 | + // Menus |
|
177 | + //------- |
|
178 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
179 | + |
|
180 | + |
|
181 | + // Exports |
|
182 | + //-------- |
|
183 | + $r=0; |
|
184 | + |
|
185 | + $r++; |
|
186 | + $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
187 | + $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
188 | + $this->export_permission[$r]=array(array("propale","export")); |
|
189 | + $this->export_fields_array[$r]=array( |
|
190 | + 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone', |
|
191 | + 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer", |
|
192 | + 'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount", |
|
193 | + 'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate', |
|
194 | + 'c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', |
|
195 | + 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct', |
|
196 | + 'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC", |
|
197 | + 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel' |
|
198 | + ); |
|
199 | + //$this->export_TypeFields_array[$r]=array( |
|
200 | + // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text', |
|
201 | + // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date", |
|
202 | + // 'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text", |
|
203 | + // 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", |
|
204 | + // 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' |
|
205 | + //); |
|
206 | + $this->export_TypeFields_array[$r]=array( |
|
207 | + 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text', |
|
208 | + 's.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date", |
|
209 | + 'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date', |
|
210 | + 'pj.ref'=>'Text', 'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", |
|
211 | + 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text' |
|
212 | + ); |
|
213 | + $this->export_entities_array[$r]=array( |
|
214 | + 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company', |
|
215 | + 's.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal", |
|
216 | + 'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal", |
|
217 | + 'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', |
|
218 | + 'cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line", |
|
219 | + 'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product' |
|
220 | + ); |
|
221 | + $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
222 | + $keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra'; |
|
223 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
224 | + $keyforselect='propaldet'; $keyforelement='propal_line'; $keyforaliasextra='extra2'; |
|
225 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
226 | + $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; |
|
227 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
228 | + $keyforselect='societe'; $keyforelement='societe'; $keyforaliasextra='extra4'; |
|
229 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
230 | + |
|
231 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
232 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; |
|
233 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; |
|
234 | + |
|
235 | + if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
236 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
237 | + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; |
|
238 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid'; |
|
239 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; |
|
240 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; |
|
241 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; |
|
242 | + $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'propaldet as cd'; |
|
243 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet_extrafields as extra2 on cd.rowid = extra2.fk_object'; |
|
244 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; |
|
245 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; |
|
246 | + $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; |
|
247 | + $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('propal').')'; |
|
248 | + if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
249 | + } |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * Function called when module is enabled. |
|
254 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
255 | + * It also creates data directories |
|
256 | + * |
|
257 | 257 | * @param string $options Options when enabling module ('', 'noboxes') |
258 | - * @return int 1 if OK, 0 if KO |
|
259 | - */ |
|
260 | - function init($options='') |
|
261 | - { |
|
262 | - global $conf,$langs; |
|
263 | - |
|
264 | - // Remove permissions and default values |
|
265 | - $this->remove($options); |
|
266 | - |
|
267 | - //ODT template |
|
268 | - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; |
|
269 | - $dirodt=DOL_DATA_ROOT.'/doctemplates/proposals'; |
|
270 | - $dest=$dirodt.'/template_proposal.odt'; |
|
271 | - |
|
272 | - if (file_exists($src) && ! file_exists($dest)) |
|
273 | - { |
|
274 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
275 | - dol_mkdir($dirodt); |
|
276 | - $result=dol_copy($src,$dest,0,0); |
|
277 | - if ($result < 0) |
|
278 | - { |
|
279 | - $langs->load("errors"); |
|
280 | - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); |
|
281 | - return 0; |
|
282 | - } |
|
283 | - } |
|
284 | - |
|
285 | - $sql = array( |
|
286 | - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'propal' AND entity = ".$conf->entity, |
|
287 | - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','propal',".$conf->entity.")", |
|
288 | - ); |
|
289 | - |
|
290 | - return $this->_init($sql,$options); |
|
291 | - } |
|
258 | + * @return int 1 if OK, 0 if KO |
|
259 | + */ |
|
260 | + function init($options='') |
|
261 | + { |
|
262 | + global $conf,$langs; |
|
263 | + |
|
264 | + // Remove permissions and default values |
|
265 | + $this->remove($options); |
|
266 | + |
|
267 | + //ODT template |
|
268 | + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; |
|
269 | + $dirodt=DOL_DATA_ROOT.'/doctemplates/proposals'; |
|
270 | + $dest=$dirodt.'/template_proposal.odt'; |
|
271 | + |
|
272 | + if (file_exists($src) && ! file_exists($dest)) |
|
273 | + { |
|
274 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
275 | + dol_mkdir($dirodt); |
|
276 | + $result=dol_copy($src,$dest,0,0); |
|
277 | + if ($result < 0) |
|
278 | + { |
|
279 | + $langs->load("errors"); |
|
280 | + $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); |
|
281 | + return 0; |
|
282 | + } |
|
283 | + } |
|
284 | + |
|
285 | + $sql = array( |
|
286 | + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'propal' AND entity = ".$conf->entity, |
|
287 | + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','propal',".$conf->entity.")", |
|
288 | + ); |
|
289 | + |
|
290 | + return $this->_init($sql,$options); |
|
291 | + } |
|
292 | 292 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * \ingroup propale |
28 | 28 | * \brief Fichier de description et activation du module Propale |
29 | 29 | */ |
30 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
30 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -51,30 +51,30 @@ discard block |
||
51 | 51 | $this->family = "crm"; |
52 | 52 | $this->module_position = '20'; |
53 | 53 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
54 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
54 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
55 | 55 | $this->description = "Gestion des propositions commerciales"; |
56 | 56 | |
57 | 57 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
58 | 58 | $this->version = 'dolibarr'; |
59 | 59 | |
60 | 60 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
61 | - $this->picto='propal'; |
|
61 | + $this->picto = 'propal'; |
|
62 | 62 | |
63 | 63 | // Data directories to create when module is enabled |
64 | 64 | $this->dirs = array("/propale/temp"); |
65 | 65 | |
66 | 66 | // Dependencies |
67 | - $this->hidden = false; // A condition to hide module |
|
68 | - $this->depends = array("modSociete"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
67 | + $this->hidden = false; // A condition to hide module |
|
68 | + $this->depends = array("modSociete"); // List of module class names as string that must be enabled if this module is enabled |
|
69 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
70 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
71 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
72 | 72 | $this->config_page_url = array("propal.php"); |
73 | - $this->langfiles = array("propal","bills","companies","deliveries","products"); |
|
73 | + $this->langfiles = array("propal", "bills", "companies", "deliveries", "products"); |
|
74 | 74 | |
75 | 75 | // Constants |
76 | 76 | $this->const = array(); |
77 | - $r=0; |
|
77 | + $r = 0; |
|
78 | 78 | |
79 | 79 | $this->const[$r][0] = "PROPALE_ADDON_PDF"; |
80 | 80 | $this->const[$r][1] = "chaine"; |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | |
113 | 113 | // Boxes |
114 | 114 | $this->boxes = array( |
115 | - 0=>array('file'=>'box_graph_propales_permonth.php','enabledbydefaulton'=>'Home'), |
|
116 | - 1=>array('file'=>'box_propales.php','enabledbydefaulton'=>'Home'), |
|
115 | + 0=>array('file'=>'box_graph_propales_permonth.php', 'enabledbydefaulton'=>'Home'), |
|
116 | + 1=>array('file'=>'box_propales.php', 'enabledbydefaulton'=>'Home'), |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | // Permissions |
120 | 120 | $this->rights = array(); |
121 | 121 | $this->rights_class = 'propale'; |
122 | - $r=0; |
|
122 | + $r = 0; |
|
123 | 123 | |
124 | 124 | $r++; |
125 | 125 | $this->rights[$r][0] = 21; // id de la permission |
@@ -175,26 +175,26 @@ discard block |
||
175 | 175 | |
176 | 176 | // Menus |
177 | 177 | //------- |
178 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
178 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
179 | 179 | |
180 | 180 | |
181 | 181 | // Exports |
182 | 182 | //-------- |
183 | - $r=0; |
|
183 | + $r = 0; |
|
184 | 184 | |
185 | 185 | $r++; |
186 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
187 | - $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
188 | - $this->export_permission[$r]=array(array("propale","export")); |
|
189 | - $this->export_fields_array[$r]=array( |
|
190 | - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone', |
|
191 | - 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer", |
|
192 | - 'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount", |
|
193 | - 'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate', |
|
194 | - 'c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', |
|
195 | - 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct', |
|
196 | - 'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC", |
|
197 | - 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel' |
|
186 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
187 | + $this->export_label[$r] = 'ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
188 | + $this->export_permission[$r] = array(array("propale", "export")); |
|
189 | + $this->export_fields_array[$r] = array( |
|
190 | + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone', |
|
191 | + 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", |
|
192 | + 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal", 'c.remise_percent'=>"GlobalDiscount", |
|
193 | + 'c.total_ht'=>"TotalHT", 'c.total'=>"TotalTTC", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', |
|
194 | + 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', |
|
195 | + 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', |
|
196 | + 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", |
|
197 | + 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' |
|
198 | 198 | ); |
199 | 199 | //$this->export_TypeFields_array[$r]=array( |
200 | 200 | // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text', |
@@ -203,49 +203,49 @@ discard block |
||
203 | 203 | // 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", |
204 | 204 | // 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' |
205 | 205 | //); |
206 | - $this->export_TypeFields_array[$r]=array( |
|
207 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text', |
|
208 | - 's.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date", |
|
209 | - 'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date', |
|
210 | - 'pj.ref'=>'Text', 'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", |
|
211 | - 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text' |
|
206 | + $this->export_TypeFields_array[$r] = array( |
|
207 | + 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', |
|
208 | + 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.datec'=>"Date", 'c.datep'=>"Date", 'c.fin_validite'=>"Date", |
|
209 | + 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', |
|
210 | + 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", |
|
211 | + 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.ref'=>'Text', 'p.label'=>'Text' |
|
212 | 212 | ); |
213 | - $this->export_entities_array[$r]=array( |
|
214 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company', |
|
215 | - 's.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal", |
|
216 | - 'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal", |
|
217 | - 'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', |
|
218 | - 'cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line", |
|
219 | - 'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product' |
|
213 | + $this->export_entities_array[$r] = array( |
|
214 | + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company', |
|
215 | + 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"propal", 'c.ref'=>"propal", 'c.ref_client'=>"propal", |
|
216 | + 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.remise_percent'=>"propal", 'c.total_ht'=>"propal", |
|
217 | + 'c.total'=>"propal", 'c.fk_statut'=>"propal", 'c.note_public'=>"propal", 'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', |
|
218 | + 'cd.label'=>"propal_line", 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line", |
|
219 | + 'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' |
|
220 | 220 | ); |
221 | - $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
222 | - $keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra'; |
|
221 | + $this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
222 | + $keyforselect = 'propal'; $keyforelement = 'propal'; $keyforaliasextra = 'extra'; |
|
223 | 223 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
224 | - $keyforselect='propaldet'; $keyforelement='propal_line'; $keyforaliasextra='extra2'; |
|
224 | + $keyforselect = 'propaldet'; $keyforelement = 'propal_line'; $keyforaliasextra = 'extra2'; |
|
225 | 225 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
226 | - $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; |
|
226 | + $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; |
|
227 | 227 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
228 | - $keyforselect='societe'; $keyforelement='societe'; $keyforaliasextra='extra4'; |
|
228 | + $keyforselect = 'societe'; $keyforelement = 'societe'; $keyforaliasextra = 'extra4'; |
|
229 | 229 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
230 | 230 | |
231 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
232 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; |
|
233 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; |
|
234 | - |
|
235 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
236 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
237 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; |
|
238 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid'; |
|
239 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; |
|
240 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; |
|
241 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; |
|
242 | - $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'propaldet as cd'; |
|
243 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet_extrafields as extra2 on cd.rowid = extra2.fk_object'; |
|
244 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; |
|
245 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; |
|
246 | - $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; |
|
247 | - $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('propal').')'; |
|
248 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
231 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
232 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s '; |
|
233 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; |
|
234 | + |
|
235 | + if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
236 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
237 | + $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'propal as c'; |
|
238 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid'; |
|
239 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; |
|
240 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; |
|
241 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; |
|
242 | + $this->export_sql_end[$r] .= ', '.MAIN_DB_PREFIX.'propaldet as cd'; |
|
243 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet_extrafields as extra2 on cd.rowid = extra2.fk_object'; |
|
244 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; |
|
245 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; |
|
246 | + $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; |
|
247 | + $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')'; |
|
248 | + if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -257,27 +257,27 @@ discard block |
||
257 | 257 | * @param string $options Options when enabling module ('', 'noboxes') |
258 | 258 | * @return int 1 if OK, 0 if KO |
259 | 259 | */ |
260 | - function init($options='') |
|
260 | + function init($options = '') |
|
261 | 261 | { |
262 | - global $conf,$langs; |
|
262 | + global $conf, $langs; |
|
263 | 263 | |
264 | 264 | // Remove permissions and default values |
265 | 265 | $this->remove($options); |
266 | 266 | |
267 | 267 | //ODT template |
268 | - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; |
|
269 | - $dirodt=DOL_DATA_ROOT.'/doctemplates/proposals'; |
|
270 | - $dest=$dirodt.'/template_proposal.odt'; |
|
268 | + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; |
|
269 | + $dirodt = DOL_DATA_ROOT.'/doctemplates/proposals'; |
|
270 | + $dest = $dirodt.'/template_proposal.odt'; |
|
271 | 271 | |
272 | - if (file_exists($src) && ! file_exists($dest)) |
|
272 | + if (file_exists($src) && !file_exists($dest)) |
|
273 | 273 | { |
274 | 274 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
275 | 275 | dol_mkdir($dirodt); |
276 | - $result=dol_copy($src,$dest,0,0); |
|
276 | + $result = dol_copy($src, $dest, 0, 0); |
|
277 | 277 | if ($result < 0) |
278 | 278 | { |
279 | 279 | $langs->load("errors"); |
280 | - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); |
|
280 | + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); |
|
281 | 281 | return 0; |
282 | 282 | } |
283 | 283 | } |
@@ -287,6 +287,6 @@ discard block |
||
287 | 287 | "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','propal',".$conf->entity.")", |
288 | 288 | ); |
289 | 289 | |
290 | - return $this->_init($sql,$options); |
|
290 | + return $this->_init($sql, $options); |
|
291 | 291 | } |
292 | 292 | } |
@@ -232,7 +232,9 @@ discard block |
||
232 | 232 | $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; |
233 | 233 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; |
234 | 234 | |
235 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
235 | + if(!$user->rights->societe->client->voir) { |
|
236 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
237 | + } |
|
236 | 238 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
237 | 239 | $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; |
238 | 240 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid'; |
@@ -245,7 +247,9 @@ discard block |
||
245 | 247 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; |
246 | 248 | $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; |
247 | 249 | $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('propal').')'; |
248 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
250 | + if(!$user->rights->societe->client->voir) { |
|
251 | + $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
252 | + } |
|
249 | 253 | } |
250 | 254 | |
251 | 255 |
@@ -33,101 +33,101 @@ |
||
33 | 33 | */ |
34 | 34 | class modProductBatch extends DolibarrModules |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | - * |
|
39 | - * @param DoliDB $db Database handler |
|
40 | - */ |
|
41 | - function __construct($db) |
|
42 | - { |
|
36 | + /** |
|
37 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
38 | + * |
|
39 | + * @param DoliDB $db Database handler |
|
40 | + */ |
|
41 | + function __construct($db) |
|
42 | + { |
|
43 | 43 | global $langs,$conf; |
44 | 44 | |
45 | 45 | $this->db = $db; |
46 | - $this->numero = 39000; |
|
46 | + $this->numero = 39000; |
|
47 | 47 | |
48 | - $this->family = "products"; |
|
49 | - $this->module_position = '45'; |
|
48 | + $this->family = "products"; |
|
49 | + $this->module_position = '45'; |
|
50 | 50 | |
51 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | - $this->description = "Batch number, eat-by and sell-by date management module"; |
|
51 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->description = "Batch number, eat-by and sell-by date management module"; |
|
53 | 53 | |
54 | - $this->rights_class = 'productbatch'; |
|
55 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
56 | - $this->version = 'dolibarr'; |
|
57 | - // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase) |
|
58 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
54 | + $this->rights_class = 'productbatch'; |
|
55 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
56 | + $this->version = 'dolibarr'; |
|
57 | + // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase) |
|
58 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | 59 | |
60 | - $this->picto='stock'; |
|
60 | + $this->picto='stock'; |
|
61 | 61 | |
62 | - $this->module_parts = array(); |
|
62 | + $this->module_parts = array(); |
|
63 | 63 | |
64 | - // Data directories to create when module is enabled. |
|
65 | - $this->dirs = array(); |
|
64 | + // Data directories to create when module is enabled. |
|
65 | + $this->dirs = array(); |
|
66 | 66 | |
67 | - // Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module. |
|
68 | - $this->config_page_url = array("product_lot_extrafields.php@product"); |
|
67 | + // Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module. |
|
68 | + $this->config_page_url = array("product_lot_extrafields.php@product"); |
|
69 | 69 | |
70 | - // Dependencies |
|
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of module class names as string that must be enabled if this module is enabled |
|
73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | - $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
77 | - $this->langfiles = array("productbatch"); |
|
70 | + // Dependencies |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of module class names as string that must be enabled if this module is enabled |
|
73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | + $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
77 | + $this->langfiles = array("productbatch"); |
|
78 | 78 | |
79 | - // Constants |
|
80 | - $this->const = array(); |
|
79 | + // Constants |
|
80 | + $this->const = array(); |
|
81 | 81 | |
82 | 82 | $this->tabs = array(); |
83 | 83 | |
84 | 84 | // Dictionaries |
85 | - if (! isset($conf->productbatch->enabled)) |
|
85 | + if (! isset($conf->productbatch->enabled)) |
|
86 | 86 | { |
87 | - $conf->productbatch=new stdClass(); |
|
88 | - $conf->productbatch->enabled=0; |
|
87 | + $conf->productbatch=new stdClass(); |
|
88 | + $conf->productbatch->enabled=0; |
|
89 | 89 | } |
90 | - $this->dictionaries=array(); |
|
90 | + $this->dictionaries=array(); |
|
91 | 91 | |
92 | 92 | // Boxes |
93 | 93 | $this->boxes = array(); // List of boxes |
94 | 94 | |
95 | - // Permissions |
|
96 | - $this->rights = array(); // Permission array used by this module |
|
97 | - $r=0; |
|
95 | + // Permissions |
|
96 | + $this->rights = array(); // Permission array used by this module |
|
97 | + $r=0; |
|
98 | 98 | |
99 | 99 | |
100 | - // Menus |
|
101 | - //------- |
|
102 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
100 | + // Menus |
|
101 | + //------- |
|
102 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
103 | 103 | |
104 | 104 | |
105 | - // Exports |
|
106 | - $r=0; |
|
107 | - } |
|
105 | + // Exports |
|
106 | + $r=0; |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * Function called when module is enabled. |
|
111 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
112 | - * It also creates data directories |
|
113 | - * |
|
109 | + /** |
|
110 | + * Function called when module is enabled. |
|
111 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
112 | + * It also creates data directories |
|
113 | + * |
|
114 | 114 | * @param string $options Options when enabling module ('', 'noboxes') |
115 | - * @return int 1 if OK, 0 if KO |
|
116 | - */ |
|
117 | - function init($options='') |
|
118 | - { |
|
119 | - global $db,$conf; |
|
120 | - |
|
121 | - $sql = array(); |
|
122 | - |
|
123 | - if (! empty($conf->cashdesk->enabled)) { |
|
124 | - if (empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { |
|
125 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
|
126 | - $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - return $this->_init($sql, $options); |
|
131 | - } |
|
115 | + * @return int 1 if OK, 0 if KO |
|
116 | + */ |
|
117 | + function init($options='') |
|
118 | + { |
|
119 | + global $db,$conf; |
|
120 | + |
|
121 | + $sql = array(); |
|
122 | + |
|
123 | + if (! empty($conf->cashdesk->enabled)) { |
|
124 | + if (empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { |
|
125 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
|
126 | + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + return $this->_init($sql, $options); |
|
131 | + } |
|
132 | 132 | } |
133 | 133 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup productbatch |
26 | 26 | * \brief Description and activation file for module productbatch |
27 | 27 | */ |
28 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function __construct($db) |
42 | 42 | { |
43 | - global $langs,$conf; |
|
43 | + global $langs, $conf; |
|
44 | 44 | |
45 | 45 | $this->db = $db; |
46 | 46 | $this->numero = 39000; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->family = "products"; |
49 | 49 | $this->module_position = '45'; |
50 | 50 | |
51 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
52 | 52 | $this->description = "Batch number, eat-by and sell-by date management module"; |
53 | 53 | |
54 | 54 | $this->rights_class = 'productbatch'; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase) |
58 | 58 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
59 | 59 | |
60 | - $this->picto='stock'; |
|
60 | + $this->picto = 'stock'; |
|
61 | 61 | |
62 | 62 | $this->module_parts = array(); |
63 | 63 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $this->config_page_url = array("product_lot_extrafields.php@product"); |
69 | 69 | |
70 | 70 | // Dependencies |
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of module class names as string that must be enabled if this module is enabled |
|
73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | - $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array("modProduct", "modStock", "modExpedition", "modFournisseur"); // List of module class names as string that must be enabled if this module is enabled |
|
73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
76 | + $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module |
|
77 | 77 | $this->langfiles = array("productbatch"); |
78 | 78 | |
79 | 79 | // Constants |
@@ -82,28 +82,28 @@ discard block |
||
82 | 82 | $this->tabs = array(); |
83 | 83 | |
84 | 84 | // Dictionaries |
85 | - if (! isset($conf->productbatch->enabled)) |
|
85 | + if (!isset($conf->productbatch->enabled)) |
|
86 | 86 | { |
87 | - $conf->productbatch=new stdClass(); |
|
88 | - $conf->productbatch->enabled=0; |
|
87 | + $conf->productbatch = new stdClass(); |
|
88 | + $conf->productbatch->enabled = 0; |
|
89 | 89 | } |
90 | - $this->dictionaries=array(); |
|
90 | + $this->dictionaries = array(); |
|
91 | 91 | |
92 | 92 | // Boxes |
93 | - $this->boxes = array(); // List of boxes |
|
93 | + $this->boxes = array(); // List of boxes |
|
94 | 94 | |
95 | 95 | // Permissions |
96 | - $this->rights = array(); // Permission array used by this module |
|
97 | - $r=0; |
|
96 | + $this->rights = array(); // Permission array used by this module |
|
97 | + $r = 0; |
|
98 | 98 | |
99 | 99 | |
100 | 100 | // Menus |
101 | 101 | //------- |
102 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
102 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
103 | 103 | |
104 | 104 | |
105 | 105 | // Exports |
106 | - $r=0; |
|
106 | + $r = 0; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | * @param string $options Options when enabling module ('', 'noboxes') |
115 | 115 | * @return int 1 if OK, 0 if KO |
116 | 116 | */ |
117 | - function init($options='') |
|
117 | + function init($options = '') |
|
118 | 118 | { |
119 | - global $db,$conf; |
|
119 | + global $db, $conf; |
|
120 | 120 | |
121 | 121 | $sql = array(); |
122 | 122 | |
123 | - if (! empty($conf->cashdesk->enabled)) { |
|
123 | + if (!empty($conf->cashdesk->enabled)) { |
|
124 | 124 | if (empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { |
125 | 125 | include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
126 | - $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
|
126 | + $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 |
@@ -30,122 +30,122 @@ |
||
30 | 30 | */ |
31 | 31 | class mod_holiday_immaculate extends ModelNumRefHolidays |
32 | 32 | { |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * Dolibarr version of the loaded document |
35 | 35 | * @public string |
36 | 36 | */ |
37 | - public $version = 'dolibarr'; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var string Error message |
|
41 | - */ |
|
42 | - public $error = ''; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string Nom du modele |
|
46 | - * @deprecated |
|
47 | - * @see $name |
|
48 | - */ |
|
49 | - public $nom='Immaculate'; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var string model name |
|
53 | - */ |
|
54 | - public $name='Immaculate'; |
|
55 | - |
|
56 | - public $code_auto=1; |
|
57 | - |
|
58 | - /** |
|
59 | - * Return default description of numbering model |
|
60 | - * |
|
61 | - * @return string text description |
|
62 | - */ |
|
63 | - function info() |
|
37 | + public $version = 'dolibarr'; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var string Error message |
|
41 | + */ |
|
42 | + public $error = ''; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string Nom du modele |
|
46 | + * @deprecated |
|
47 | + * @see $name |
|
48 | + */ |
|
49 | + public $nom='Immaculate'; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var string model name |
|
53 | + */ |
|
54 | + public $name='Immaculate'; |
|
55 | + |
|
56 | + public $code_auto=1; |
|
57 | + |
|
58 | + /** |
|
59 | + * Return default description of numbering model |
|
60 | + * |
|
61 | + * @return string text description |
|
62 | + */ |
|
63 | + function info() |
|
64 | 64 | { |
65 | - global $conf, $langs; |
|
65 | + global $conf, $langs; |
|
66 | 66 | |
67 | - $langs->load("bills"); |
|
67 | + $langs->load("bills"); |
|
68 | 68 | |
69 | - $form = new Form($this->db); |
|
69 | + $form = new Form($this->db); |
|
70 | 70 | |
71 | - $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
72 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
73 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
74 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
75 | - $texte.= '<input type="hidden" name="maskconstcontract" value="HOLIDAY_IMMACULATE_MASK">'; |
|
76 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
71 | + $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
72 | + $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
73 | + $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
74 | + $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
75 | + $texte.= '<input type="hidden" name="maskconstcontract" value="HOLIDAY_IMMACULATE_MASK">'; |
|
76 | + $texte.= '<table class="nobordernopadding" width="100%">'; |
|
77 | 77 | |
78 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); |
|
79 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
80 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
78 | + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); |
|
79 | + $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
80 | + $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
81 | + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); |
|
82 | + $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
83 | 83 | |
84 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
85 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_MASK.'">',$tooltip,1,1).'</td>'; |
|
86 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
87 | - $texte.= '</tr>'; |
|
88 | - $texte.= '</table>'; |
|
89 | - $texte.= '</form>'; |
|
84 | + $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
85 | + $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_MASK.'">',$tooltip,1,1).'</td>'; |
|
86 | + $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
87 | + $texte.= '</tr>'; |
|
88 | + $texte.= '</table>'; |
|
89 | + $texte.= '</form>'; |
|
90 | 90 | |
91 | - return $texte; |
|
91 | + return $texte; |
|
92 | 92 | } |
93 | 93 | |
94 | - /** |
|
95 | - * Return numbering example |
|
96 | - * |
|
97 | - * @return string Example |
|
98 | - */ |
|
94 | + /** |
|
95 | + * Return numbering example |
|
96 | + * |
|
97 | + * @return string Example |
|
98 | + */ |
|
99 | 99 | function getExample() |
100 | 100 | { |
101 | - global $conf,$langs,$user; |
|
102 | - |
|
103 | - $old_login=$user->login; |
|
104 | - $user->login='UUUUUUU'; |
|
105 | - $numExample = $this->getNextValue($user, ''); |
|
106 | - $user->login=$old_login; |
|
107 | - |
|
108 | - if (! $numExample) |
|
109 | - { |
|
110 | - $numExample = $langs->trans('NotConfigured'); |
|
111 | - } |
|
112 | - return $numExample; |
|
101 | + global $conf,$langs,$user; |
|
102 | + |
|
103 | + $old_login=$user->login; |
|
104 | + $user->login='UUUUUUU'; |
|
105 | + $numExample = $this->getNextValue($user, ''); |
|
106 | + $user->login=$old_login; |
|
107 | + |
|
108 | + if (! $numExample) |
|
109 | + { |
|
110 | + $numExample = $langs->trans('NotConfigured'); |
|
111 | + } |
|
112 | + return $numExample; |
|
113 | 113 | } |
114 | 114 | |
115 | - /** |
|
116 | - * Return next value |
|
117 | - * |
|
118 | - * @param Societe $user user object |
|
119 | - * @param Object $holiday holiday object |
|
120 | - * @return string Value if OK, 0 if KO |
|
121 | - */ |
|
115 | + /** |
|
116 | + * Return next value |
|
117 | + * |
|
118 | + * @param Societe $user user object |
|
119 | + * @param Object $holiday holiday object |
|
120 | + * @return string Value if OK, 0 if KO |
|
121 | + */ |
|
122 | 122 | function getNextValue($user, $holiday) |
123 | 123 | { |
124 | - global $db,$conf; |
|
124 | + global $db,$conf; |
|
125 | 125 | |
126 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
126 | + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
127 | 127 | |
128 | - $mask=$conf->global->HOLIDAY_IMMACULATE_MASK; |
|
128 | + $mask=$conf->global->HOLIDAY_IMMACULATE_MASK; |
|
129 | 129 | |
130 | - if (! $mask) |
|
131 | - { |
|
132 | - $this->error='NotConfigured'; |
|
133 | - return 0; |
|
134 | - } |
|
130 | + if (! $mask) |
|
131 | + { |
|
132 | + $this->error='NotConfigured'; |
|
133 | + return 0; |
|
134 | + } |
|
135 | 135 | |
136 | - $numFinal=get_next_value($db,$mask,'holiday','ref','', $user, $holiday->date_create); |
|
136 | + $numFinal=get_next_value($db,$mask,'holiday','ref','', $user, $holiday->date_create); |
|
137 | 137 | |
138 | - return $numFinal; |
|
139 | - } |
|
138 | + return $numFinal; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
142 | - /** |
|
143 | - * Return next value |
|
144 | - * |
|
145 | - * @param User $fuser User object |
|
146 | - * @param Object $objforref Holiday object |
|
147 | - * @return string Value if OK, 0 if KO |
|
148 | - */ |
|
142 | + /** |
|
143 | + * Return next value |
|
144 | + * |
|
145 | + * @param User $fuser User object |
|
146 | + * @param Object $objforref Holiday object |
|
147 | + * @return string Value if OK, 0 if KO |
|
148 | + */ |
|
149 | 149 | function holiday_get_num($fuser, $objforref) |
150 | 150 | { |
151 | 151 | // phpcs:enable |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \brief File of class to manage contract numbering rules Magre |
24 | 24 | */ |
25 | 25 | |
26 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/holiday/modules_holiday.php'; |
|
26 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/holiday/modules_holiday.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class to manage contract numbering rules Magre |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @deprecated |
47 | 47 | * @see $name |
48 | 48 | */ |
49 | - public $nom='Immaculate'; |
|
49 | + public $nom = 'Immaculate'; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @var string model name |
53 | 53 | */ |
54 | - public $name='Immaculate'; |
|
54 | + public $name = 'Immaculate'; |
|
55 | 55 | |
56 | - public $code_auto=1; |
|
56 | + public $code_auto = 1; |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Return default description of numbering model |
@@ -69,24 +69,24 @@ discard block |
||
69 | 69 | $form = new Form($this->db); |
70 | 70 | |
71 | 71 | $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
72 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
73 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
74 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
75 | - $texte.= '<input type="hidden" name="maskconstcontract" value="HOLIDAY_IMMACULATE_MASK">'; |
|
76 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
77 | - |
|
78 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); |
|
79 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
80 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
83 | - |
|
84 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
85 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_MASK.'">',$tooltip,1,1).'</td>'; |
|
86 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
87 | - $texte.= '</tr>'; |
|
88 | - $texte.= '</table>'; |
|
89 | - $texte.= '</form>'; |
|
72 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
73 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
74 | + $texte .= '<input type="hidden" name="action" value="updateMask">'; |
|
75 | + $texte .= '<input type="hidden" name="maskconstcontract" value="HOLIDAY_IMMACULATE_MASK">'; |
|
76 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
77 | + |
|
78 | + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Holiday"), $langs->transnoentities("Holiday")); |
|
79 | + $tooltip .= $langs->trans("GenericMaskCodes2"); |
|
80 | + $tooltip .= $langs->trans("GenericMaskCodes3"); |
|
81 | + $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Holiday"), $langs->transnoentities("Holiday")); |
|
82 | + $tooltip .= $langs->trans("GenericMaskCodes5"); |
|
83 | + |
|
84 | + $texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
85 | + $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_MASK.'">', $tooltip, 1, 1).'</td>'; |
|
86 | + $texte .= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
87 | + $texte .= '</tr>'; |
|
88 | + $texte .= '</table>'; |
|
89 | + $texte .= '</form>'; |
|
90 | 90 | |
91 | 91 | return $texte; |
92 | 92 | } |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | */ |
99 | 99 | function getExample() |
100 | 100 | { |
101 | - global $conf,$langs,$user; |
|
101 | + global $conf, $langs, $user; |
|
102 | 102 | |
103 | - $old_login=$user->login; |
|
104 | - $user->login='UUUUUUU'; |
|
103 | + $old_login = $user->login; |
|
104 | + $user->login = 'UUUUUUU'; |
|
105 | 105 | $numExample = $this->getNextValue($user, ''); |
106 | - $user->login=$old_login; |
|
106 | + $user->login = $old_login; |
|
107 | 107 | |
108 | - if (! $numExample) |
|
108 | + if (!$numExample) |
|
109 | 109 | { |
110 | 110 | $numExample = $langs->trans('NotConfigured'); |
111 | 111 | } |
@@ -121,19 +121,19 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function getNextValue($user, $holiday) |
123 | 123 | { |
124 | - global $db,$conf; |
|
124 | + global $db, $conf; |
|
125 | 125 | |
126 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
126 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
127 | 127 | |
128 | - $mask=$conf->global->HOLIDAY_IMMACULATE_MASK; |
|
128 | + $mask = $conf->global->HOLIDAY_IMMACULATE_MASK; |
|
129 | 129 | |
130 | - if (! $mask) |
|
130 | + if (!$mask) |
|
131 | 131 | { |
132 | - $this->error='NotConfigured'; |
|
132 | + $this->error = 'NotConfigured'; |
|
133 | 133 | return 0; |
134 | 134 | } |
135 | 135 | |
136 | - $numFinal=get_next_value($db,$mask,'holiday','ref','', $user, $holiday->date_create); |
|
136 | + $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $user, $holiday->date_create); |
|
137 | 137 | |
138 | 138 | return $numFinal; |
139 | 139 | } |
@@ -29,142 +29,142 @@ |
||
29 | 29 | */ |
30 | 30 | class mod_holiday_madonna extends ModelNumRefHolidays |
31 | 31 | { |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * Dolibarr version of the loaded document |
34 | 34 | * @public string |
35 | 35 | */ |
36 | - public $version = 'dolibarr'; |
|
36 | + public $version = 'dolibarr'; |
|
37 | 37 | |
38 | - public $prefix='HL'; |
|
38 | + public $prefix='HL'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @var string Error code (or message) |
|
42 | - */ |
|
43 | - public $error=''; |
|
40 | + /** |
|
41 | + * @var string Error code (or message) |
|
42 | + */ |
|
43 | + public $error=''; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @var string Nom du modele |
|
47 | - * @deprecated |
|
48 | - * @see $name |
|
49 | - */ |
|
50 | - public $nom='Madonna'; |
|
45 | + /** |
|
46 | + * @var string Nom du modele |
|
47 | + * @deprecated |
|
48 | + * @see $name |
|
49 | + */ |
|
50 | + public $nom='Madonna'; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @var string model name |
|
54 | - */ |
|
55 | - public $name='Madonna'; |
|
52 | + /** |
|
53 | + * @var string model name |
|
54 | + */ |
|
55 | + public $name='Madonna'; |
|
56 | 56 | |
57 | - public $code_auto=1; |
|
57 | + public $code_auto=1; |
|
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * Return default description of numbering model |
|
62 | - * |
|
63 | - * @return string text description |
|
64 | - */ |
|
60 | + /** |
|
61 | + * Return default description of numbering model |
|
62 | + * |
|
63 | + * @return string text description |
|
64 | + */ |
|
65 | 65 | function info() |
66 | 66 | { |
67 | - global $langs; |
|
68 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
67 | + global $langs; |
|
68 | + return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * Return numbering example |
|
74 | - * |
|
75 | - * @return string Example |
|
76 | - */ |
|
77 | - function getExample() |
|
78 | - { |
|
79 | - return $this->prefix."0501-0001"; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * Test if existing numbers make problems with numbering |
|
85 | - * |
|
86 | - * @return boolean false if conflit, true if ok |
|
87 | - */ |
|
88 | - function canBeActivated() |
|
89 | - { |
|
90 | - global $conf,$langs,$db; |
|
91 | - |
|
92 | - $coyymm=''; $max=''; |
|
93 | - |
|
94 | - $posindice=8; |
|
95 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
96 | - $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
97 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | - $sql.= " AND entity = ".$conf->entity; |
|
99 | - |
|
100 | - $resql=$db->query($sql); |
|
101 | - if ($resql) |
|
102 | - { |
|
103 | - $row = $db->fetch_row($resql); |
|
104 | - if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; } |
|
105 | - } |
|
106 | - if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm)) |
|
107 | - { |
|
108 | - $langs->load("errors"); |
|
109 | - $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
110 | - return false; |
|
111 | - } |
|
112 | - |
|
113 | - return true; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * Return next value |
|
118 | - * |
|
119 | - * @param Societe $objsoc third party object |
|
120 | - * @param Object $holiday Holiday object |
|
121 | - * @return string Value if OK, 0 if KO |
|
122 | - */ |
|
123 | - function getNextValue($objsoc, $holiday) |
|
124 | - { |
|
125 | - global $db,$conf; |
|
126 | - |
|
127 | - $posindice=8; |
|
128 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
129 | - $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
130 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
131 | - $sql.= " AND entity = ".$conf->entity; |
|
132 | - |
|
133 | - $resql=$db->query($sql); |
|
134 | - if ($resql) |
|
135 | - { |
|
136 | - $obj = $db->fetch_object($resql); |
|
137 | - if ($obj) $max = intval($obj->max); |
|
138 | - else $max=0; |
|
139 | - } |
|
140 | - else |
|
141 | - { |
|
142 | - dol_syslog("mod_holiday_madonna::getNextValue", LOG_DEBUG); |
|
143 | - return -1; |
|
144 | - } |
|
145 | - |
|
146 | - $date=$holiday->date_debut; |
|
147 | - $yymm = strftime("%y%m",$date); |
|
148 | - |
|
149 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
150 | - else $num = sprintf("%04s",$max+1); |
|
151 | - |
|
152 | - dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); |
|
153 | - return $this->prefix.$yymm."-".$num; |
|
154 | - } |
|
72 | + /** |
|
73 | + * Return numbering example |
|
74 | + * |
|
75 | + * @return string Example |
|
76 | + */ |
|
77 | + function getExample() |
|
78 | + { |
|
79 | + return $this->prefix."0501-0001"; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * Test if existing numbers make problems with numbering |
|
85 | + * |
|
86 | + * @return boolean false if conflit, true if ok |
|
87 | + */ |
|
88 | + function canBeActivated() |
|
89 | + { |
|
90 | + global $conf,$langs,$db; |
|
91 | + |
|
92 | + $coyymm=''; $max=''; |
|
93 | + |
|
94 | + $posindice=8; |
|
95 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
96 | + $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
97 | + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | + $sql.= " AND entity = ".$conf->entity; |
|
99 | + |
|
100 | + $resql=$db->query($sql); |
|
101 | + if ($resql) |
|
102 | + { |
|
103 | + $row = $db->fetch_row($resql); |
|
104 | + if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; } |
|
105 | + } |
|
106 | + if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm)) |
|
107 | + { |
|
108 | + $langs->load("errors"); |
|
109 | + $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
110 | + return false; |
|
111 | + } |
|
112 | + |
|
113 | + return true; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * Return next value |
|
118 | + * |
|
119 | + * @param Societe $objsoc third party object |
|
120 | + * @param Object $holiday Holiday object |
|
121 | + * @return string Value if OK, 0 if KO |
|
122 | + */ |
|
123 | + function getNextValue($objsoc, $holiday) |
|
124 | + { |
|
125 | + global $db,$conf; |
|
126 | + |
|
127 | + $posindice=8; |
|
128 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
129 | + $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
130 | + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
131 | + $sql.= " AND entity = ".$conf->entity; |
|
132 | + |
|
133 | + $resql=$db->query($sql); |
|
134 | + if ($resql) |
|
135 | + { |
|
136 | + $obj = $db->fetch_object($resql); |
|
137 | + if ($obj) $max = intval($obj->max); |
|
138 | + else $max=0; |
|
139 | + } |
|
140 | + else |
|
141 | + { |
|
142 | + dol_syslog("mod_holiday_madonna::getNextValue", LOG_DEBUG); |
|
143 | + return -1; |
|
144 | + } |
|
145 | + |
|
146 | + $date=$holiday->date_debut; |
|
147 | + $yymm = strftime("%y%m",$date); |
|
148 | + |
|
149 | + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
150 | + else $num = sprintf("%04s",$max+1); |
|
151 | + |
|
152 | + dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); |
|
153 | + return $this->prefix.$yymm."-".$num; |
|
154 | + } |
|
155 | 155 | |
156 | 156 | |
157 | 157 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
158 | - /** |
|
159 | - * Return next value |
|
160 | - * |
|
161 | - * @param User $fuser User object |
|
162 | - * @param Object $objforref Holiday object |
|
163 | - * @return string Value if OK, 0 if KO |
|
164 | - */ |
|
165 | - function holiday_get_num($fuser,$objforref) |
|
166 | - { |
|
158 | + /** |
|
159 | + * Return next value |
|
160 | + * |
|
161 | + * @param User $fuser User object |
|
162 | + * @param Object $objforref Holiday object |
|
163 | + * @return string Value if OK, 0 if KO |
|
164 | + */ |
|
165 | + function holiday_get_num($fuser,$objforref) |
|
166 | + { |
|
167 | 167 | // phpcs:enable |
168 | - return $this->getNextValue($fuser,$objforref); |
|
169 | - } |
|
168 | + return $this->getNextValue($fuser,$objforref); |
|
169 | + } |
|
170 | 170 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup contract |
23 | 23 | * \brief File of class to manage contract numbering rules Serpis |
24 | 24 | */ |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/holiday/modules_holiday.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/holiday/modules_holiday.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class to manage contract numbering rules madonna |
@@ -35,26 +35,26 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public $version = 'dolibarr'; |
37 | 37 | |
38 | - public $prefix='HL'; |
|
38 | + public $prefix = 'HL'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var string Error code (or message) |
42 | 42 | */ |
43 | - public $error=''; |
|
43 | + public $error = ''; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var string Nom du modele |
47 | 47 | * @deprecated |
48 | 48 | * @see $name |
49 | 49 | */ |
50 | - public $nom='Madonna'; |
|
50 | + public $nom = 'Madonna'; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @var string model name |
54 | 54 | */ |
55 | - public $name='Madonna'; |
|
55 | + public $name = 'Madonna'; |
|
56 | 56 | |
57 | - public $code_auto=1; |
|
57 | + public $code_auto = 1; |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function info() |
66 | 66 | { |
67 | 67 | global $langs; |
68 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
68 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -87,26 +87,26 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function canBeActivated() |
89 | 89 | { |
90 | - global $conf,$langs,$db; |
|
90 | + global $conf, $langs, $db; |
|
91 | 91 | |
92 | - $coyymm=''; $max=''; |
|
92 | + $coyymm = ''; $max = ''; |
|
93 | 93 | |
94 | - $posindice=8; |
|
94 | + $posindice = 8; |
|
95 | 95 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
96 | - $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
97 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | - $sql.= " AND entity = ".$conf->entity; |
|
96 | + $sql .= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
97 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | + $sql .= " AND entity = ".$conf->entity; |
|
99 | 99 | |
100 | - $resql=$db->query($sql); |
|
100 | + $resql = $db->query($sql); |
|
101 | 101 | if ($resql) |
102 | 102 | { |
103 | 103 | $row = $db->fetch_row($resql); |
104 | - if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; } |
|
104 | + if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
105 | 105 | } |
106 | - if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm)) |
|
106 | + if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) |
|
107 | 107 | { |
108 | 108 | $langs->load("errors"); |
109 | - $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
109 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function getNextValue($objsoc, $holiday) |
124 | 124 | { |
125 | - global $db,$conf; |
|
125 | + global $db, $conf; |
|
126 | 126 | |
127 | - $posindice=8; |
|
127 | + $posindice = 8; |
|
128 | 128 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
129 | - $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
130 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
131 | - $sql.= " AND entity = ".$conf->entity; |
|
129 | + $sql .= " FROM ".MAIN_DB_PREFIX."holiday"; |
|
130 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
131 | + $sql .= " AND entity = ".$conf->entity; |
|
132 | 132 | |
133 | - $resql=$db->query($sql); |
|
133 | + $resql = $db->query($sql); |
|
134 | 134 | if ($resql) |
135 | 135 | { |
136 | 136 | $obj = $db->fetch_object($resql); |
137 | 137 | if ($obj) $max = intval($obj->max); |
138 | - else $max=0; |
|
138 | + else $max = 0; |
|
139 | 139 | } |
140 | 140 | else |
141 | 141 | { |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | return -1; |
144 | 144 | } |
145 | 145 | |
146 | - $date=$holiday->date_debut; |
|
147 | - $yymm = strftime("%y%m",$date); |
|
146 | + $date = $holiday->date_debut; |
|
147 | + $yymm = strftime("%y%m", $date); |
|
148 | 148 | |
149 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
150 | - else $num = sprintf("%04s",$max+1); |
|
149 | + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
150 | + else $num = sprintf("%04s", $max + 1); |
|
151 | 151 | |
152 | 152 | dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); |
153 | 153 | return $this->prefix.$yymm."-".$num; |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * @param Object $objforref Holiday object |
163 | 163 | * @return string Value if OK, 0 if KO |
164 | 164 | */ |
165 | - function holiday_get_num($fuser,$objforref) |
|
165 | + function holiday_get_num($fuser, $objforref) |
|
166 | 166 | { |
167 | 167 | // phpcs:enable |
168 | - return $this->getNextValue($fuser,$objforref); |
|
168 | + return $this->getNextValue($fuser, $objforref); |
|
169 | 169 | } |
170 | 170 | } |
@@ -134,10 +134,12 @@ discard block |
||
134 | 134 | if ($resql) |
135 | 135 | { |
136 | 136 | $obj = $db->fetch_object($resql); |
137 | - if ($obj) $max = intval($obj->max); |
|
138 | - else $max=0; |
|
139 | - } |
|
140 | - else |
|
137 | + if ($obj) { |
|
138 | + $max = intval($obj->max); |
|
139 | + } else { |
|
140 | + $max=0; |
|
141 | + } |
|
142 | + } else |
|
141 | 143 | { |
142 | 144 | dol_syslog("mod_holiday_madonna::getNextValue", LOG_DEBUG); |
143 | 145 | return -1; |
@@ -146,8 +148,13 @@ discard block |
||
146 | 148 | $date=$holiday->date_debut; |
147 | 149 | $yymm = strftime("%y%m",$date); |
148 | 150 | |
149 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
150 | - else $num = sprintf("%04s",$max+1); |
|
151 | + if ($max >= (pow(10, 4) - 1)) { |
|
152 | + $num=$max+1; |
|
153 | + } |
|
154 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
155 | + else { |
|
156 | + $num = sprintf("%04s",$max+1); |
|
157 | + } |
|
151 | 158 | |
152 | 159 | dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); |
153 | 160 | return $this->prefix.$yymm."-".$num; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * \brief File with parent class for generating holiday to PDF and File of class to manage contract numbering |
31 | 31 | */ |
32 | 32 | |
33 | - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; |
|
33 | + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -38,33 +38,33 @@ discard block |
||
38 | 38 | */ |
39 | 39 | abstract class ModelePDFHoliday extends CommonDocGenerator |
40 | 40 | { |
41 | - /** |
|
42 | - * @var string Error code (or message) |
|
43 | - */ |
|
44 | - public $error=''; |
|
41 | + /** |
|
42 | + * @var string Error code (or message) |
|
43 | + */ |
|
44 | + public $error=''; |
|
45 | 45 | |
46 | 46 | |
47 | 47 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
48 | 48 | /** |
49 | - * Return list of active generation modules |
|
50 | - * |
|
49 | + * Return list of active generation modules |
|
50 | + * |
|
51 | 51 | * @param DoliDB $db Database handler |
52 | 52 | * @param integer $maxfilenamelength Max length of value to show |
53 | 53 | * @return array List of templates |
54 | 54 | */ |
55 | - static function liste_modeles($db, $maxfilenamelength=0) |
|
56 | - { |
|
55 | + static function liste_modeles($db, $maxfilenamelength=0) |
|
56 | + { |
|
57 | 57 | // phpcs:enable |
58 | - global $conf; |
|
58 | + global $conf; |
|
59 | 59 | |
60 | - $type = 'holiday'; |
|
61 | - $list = array(); |
|
60 | + $type = 'holiday'; |
|
61 | + $list = array(); |
|
62 | 62 | |
63 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
64 | - $list = getListOfModels($db, $type, $maxfilenamelength); |
|
63 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
64 | + $list = getListOfModels($db, $type, $maxfilenamelength); |
|
65 | 65 | |
66 | - return $list; |
|
67 | - } |
|
66 | + return $list; |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -73,82 +73,82 @@ discard block |
||
73 | 73 | */ |
74 | 74 | class ModelNumRefHolidays |
75 | 75 | { |
76 | - /** |
|
77 | - * @var string Error code (or message) |
|
78 | - */ |
|
79 | - public $error=''; |
|
80 | - |
|
81 | - /** |
|
82 | - * Return if a module can be used or not |
|
83 | - * |
|
84 | - * @return boolean true if module can be used |
|
85 | - */ |
|
86 | - function isEnabled() |
|
87 | - { |
|
88 | - return true; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Return default description of numbering model |
|
93 | - * |
|
94 | - * @return string text description |
|
95 | - */ |
|
96 | - function info() |
|
97 | - { |
|
98 | - global $langs; |
|
99 | - $langs->load("holidays"); |
|
100 | - return $langs->trans("NoDescription"); |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Return numbering example |
|
105 | - * |
|
106 | - * @return string Example |
|
107 | - */ |
|
108 | - function getExample() |
|
109 | - { |
|
110 | - global $langs; |
|
111 | - $langs->load("holidays"); |
|
112 | - return $langs->trans("NoExample"); |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Test if existing numbers make problems with numbering |
|
117 | - * |
|
118 | - * @return boolean false if conflict, true if ok |
|
119 | - */ |
|
120 | - function canBeActivated() |
|
121 | - { |
|
122 | - return true; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Return next value |
|
127 | - * |
|
128 | - * @param Societe $objsoc third party object |
|
129 | - * @param Object $contract contract object |
|
130 | - * @return string Value |
|
131 | - */ |
|
132 | - function getNextValue($objsoc, $contract) |
|
133 | - { |
|
134 | - global $langs; |
|
135 | - return $langs->trans("NotAvailable"); |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * Return numbering version module |
|
140 | - * |
|
141 | - * @return string Value |
|
142 | - */ |
|
143 | - function getVersion() |
|
144 | - { |
|
145 | - global $langs; |
|
146 | - $langs->load("admin"); |
|
147 | - |
|
148 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
149 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
150 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
151 | - if ($this->version) return $this->version; |
|
152 | - return $langs->trans("NotAvailable"); |
|
153 | - } |
|
76 | + /** |
|
77 | + * @var string Error code (or message) |
|
78 | + */ |
|
79 | + public $error=''; |
|
80 | + |
|
81 | + /** |
|
82 | + * Return if a module can be used or not |
|
83 | + * |
|
84 | + * @return boolean true if module can be used |
|
85 | + */ |
|
86 | + function isEnabled() |
|
87 | + { |
|
88 | + return true; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Return default description of numbering model |
|
93 | + * |
|
94 | + * @return string text description |
|
95 | + */ |
|
96 | + function info() |
|
97 | + { |
|
98 | + global $langs; |
|
99 | + $langs->load("holidays"); |
|
100 | + return $langs->trans("NoDescription"); |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Return numbering example |
|
105 | + * |
|
106 | + * @return string Example |
|
107 | + */ |
|
108 | + function getExample() |
|
109 | + { |
|
110 | + global $langs; |
|
111 | + $langs->load("holidays"); |
|
112 | + return $langs->trans("NoExample"); |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Test if existing numbers make problems with numbering |
|
117 | + * |
|
118 | + * @return boolean false if conflict, true if ok |
|
119 | + */ |
|
120 | + function canBeActivated() |
|
121 | + { |
|
122 | + return true; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Return next value |
|
127 | + * |
|
128 | + * @param Societe $objsoc third party object |
|
129 | + * @param Object $contract contract object |
|
130 | + * @return string Value |
|
131 | + */ |
|
132 | + function getNextValue($objsoc, $contract) |
|
133 | + { |
|
134 | + global $langs; |
|
135 | + return $langs->trans("NotAvailable"); |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * Return numbering version module |
|
140 | + * |
|
141 | + * @return string Value |
|
142 | + */ |
|
143 | + function getVersion() |
|
144 | + { |
|
145 | + global $langs; |
|
146 | + $langs->load("admin"); |
|
147 | + |
|
148 | + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
149 | + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
150 | + if ($this->version == 'dolibarr') return DOL_VERSION; |
|
151 | + if ($this->version) return $this->version; |
|
152 | + return $langs->trans("NotAvailable"); |
|
153 | + } |
|
154 | 154 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @var string Error code (or message) |
43 | 43 | */ |
44 | - public $error=''; |
|
44 | + public $error = ''; |
|
45 | 45 | |
46 | 46 | |
47 | 47 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param integer $maxfilenamelength Max length of value to show |
53 | 53 | * @return array List of templates |
54 | 54 | */ |
55 | - static function liste_modeles($db, $maxfilenamelength=0) |
|
55 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
56 | 56 | { |
57 | 57 | // phpcs:enable |
58 | 58 | global $conf; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * @var string Error code (or message) |
78 | 78 | */ |
79 | - public $error=''; |
|
79 | + public $error = ''; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Return if a module can be used or not |
@@ -142,10 +142,18 @@ |
||
142 | 142 | global $langs; |
143 | 143 | $langs->load("admin"); |
144 | 144 | |
145 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
146 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
147 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
148 | - if ($this->version) return $this->version; |
|
145 | + if ($this->version == 'development') { |
|
146 | + return $langs->trans("VersionDevelopment"); |
|
147 | + } |
|
148 | + if ($this->version == 'experimental') { |
|
149 | + return $langs->trans("VersionExperimental"); |
|
150 | + } |
|
151 | + if ($this->version == 'dolibarr') { |
|
152 | + return DOL_VERSION; |
|
153 | + } |
|
154 | + if ($this->version) { |
|
155 | + return $this->version; |
|
156 | + } |
|
149 | 157 | return $langs->trans("NotAvailable"); |
150 | 158 | } |
151 | 159 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | |
33 | 33 | /** |
34 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
35 | - * |
|
36 | - * @param DoliDB $db Database handler |
|
34 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
35 | + * |
|
36 | + * @param DoliDB $db Database handler |
|
37 | 37 | */ |
38 | 38 | function __construct($db) |
39 | 39 | { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
45 | 45 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
46 | 46 | $this->description = "Enable the Dolibarr web services server"; |
47 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
47 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
48 | 48 | $this->version = 'dolibarr'; |
49 | 49 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
50 | 50 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | |
60 | 60 | // Dependencies |
61 | 61 | $this->hidden = false; // A condition to hide module |
62 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
62 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
66 | 66 | $this->langfiles = array("other"); |
67 | 67 | |
68 | 68 | // Constants |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup webservices |
23 | 23 | * \brief File to describe webservices module |
24 | 24 | */ |
25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class to describe a WebServices module |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->family = "interface"; |
44 | 44 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
45 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
45 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
46 | 46 | $this->description = "Enable the Dolibarr web services server"; |
47 | 47 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
48 | 48 | $this->version = 'dolibarr'; |
49 | 49 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
50 | 50 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
51 | 51 | // Name of image file used for this module. |
52 | - $this->picto='technic'; |
|
52 | + $this->picto = 'technic'; |
|
53 | 53 | |
54 | 54 | // Data directories to create when module is enabled |
55 | 55 | $this->dirs = array(); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $this->config_page_url = array("index.php@webservices"); |
59 | 59 | |
60 | 60 | // Dependencies |
61 | - $this->hidden = false; // A condition to hide module |
|
62 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
61 | + $this->hidden = false; // A condition to hide module |
|
62 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
63 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
64 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
65 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
66 | 66 | $this->langfiles = array("other"); |
67 | 67 | |
68 | 68 | // Constants |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | // Permissions |
78 | 78 | $this->rights = array(); |
79 | 79 | $this->rights_class = 'webservices'; |
80 | - $r=0; |
|
80 | + $r = 0; |
|
81 | 81 | } |
82 | 82 | } |
@@ -31,121 +31,121 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class modEmailCollector extends DolibarrModules |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
38 | - */ |
|
39 | - public function __construct($db) |
|
40 | - { |
|
34 | + /** |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | + */ |
|
39 | + public function __construct($db) |
|
40 | + { |
|
41 | 41 | global $langs,$conf; |
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | |
45 | - // Id for module (must be unique). |
|
46 | - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
47 | - $this->numero = 50320; |
|
48 | - // Key text used to identify module (for permissions, menus, etc...) |
|
49 | - $this->rights_class = 'emailcollector'; |
|
50 | - |
|
51 | - // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' |
|
52 | - // It is used to group modules by family in module setup page |
|
53 | - $this->family = "interface"; |
|
54 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
55 | - $this->module_position = '12'; |
|
56 | - // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) |
|
57 | - //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
|
58 | - |
|
59 | - // Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module). |
|
60 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
61 | - // Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module). |
|
62 | - $this->description = "EmailCollectorDescription"; |
|
63 | - // Used only if file README.md and README-LL.md not found. |
|
64 | - $this->descriptionlong = "EmailCollectorDescription"; |
|
65 | - |
|
66 | - // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
|
67 | - $this->version = 'experimental'; |
|
68 | - // Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase) |
|
69 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | - // Name of image file used for this module. |
|
71 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
72 | - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
73 | - $this->picto='email'; |
|
74 | - |
|
75 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
76 | - // for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable) |
|
77 | - // for specific path of parts (eg: /dav/core/modules/barcode) |
|
78 | - // for specific css file (eg: /dav/css/dav.css.php) |
|
79 | - $this->module_parts = array(); |
|
80 | - |
|
81 | - // Data directories to create when module is enabled. |
|
82 | - // Example: this->dirs = array("/dav/temp","/dav/subdir"); |
|
83 | - $this->dirs = array(); |
|
84 | - |
|
85 | - // Config pages. Put here list of php page, stored into dav/admin directory, to use to setup module. |
|
86 | - $this->config_page_url = array("emailcollector_list.php"); |
|
87 | - |
|
88 | - // Dependencies |
|
89 | - $this->hidden = false; // A condition to hide module |
|
90 | - $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
93 | - $this->langfiles = array("admin"); |
|
94 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
95 | - $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module |
|
96 | - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
98 | - //$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
|
99 | - //$this->always_enabled = true; // If true, can't be disabled |
|
100 | - |
|
101 | - // Constants |
|
102 | - // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
103 | - // Example: $this->const=array(0=>array('DAV_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
104 | - // 1=>array('DAV_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
105 | - // ); |
|
106 | - $this->const = array( |
|
107 | - //1=>array('DAV_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) |
|
108 | - ); |
|
109 | - |
|
110 | - |
|
111 | - if (! isset($conf->dav) || ! isset($conf->dav->enabled)) |
|
112 | - { |
|
113 | - $conf->dav=new stdClass(); |
|
114 | - $conf->dav->enabled=0; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - // Array to add new pages in new tabs |
|
45 | + // Id for module (must be unique). |
|
46 | + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
47 | + $this->numero = 50320; |
|
48 | + // Key text used to identify module (for permissions, menus, etc...) |
|
49 | + $this->rights_class = 'emailcollector'; |
|
50 | + |
|
51 | + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' |
|
52 | + // It is used to group modules by family in module setup page |
|
53 | + $this->family = "interface"; |
|
54 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
55 | + $this->module_position = '12'; |
|
56 | + // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) |
|
57 | + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
|
58 | + |
|
59 | + // Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module). |
|
60 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
61 | + // Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module). |
|
62 | + $this->description = "EmailCollectorDescription"; |
|
63 | + // Used only if file README.md and README-LL.md not found. |
|
64 | + $this->descriptionlong = "EmailCollectorDescription"; |
|
65 | + |
|
66 | + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
|
67 | + $this->version = 'experimental'; |
|
68 | + // Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase) |
|
69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | + // Name of image file used for this module. |
|
71 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
72 | + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
73 | + $this->picto='email'; |
|
74 | + |
|
75 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
76 | + // for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable) |
|
77 | + // for specific path of parts (eg: /dav/core/modules/barcode) |
|
78 | + // for specific css file (eg: /dav/css/dav.css.php) |
|
79 | + $this->module_parts = array(); |
|
80 | + |
|
81 | + // Data directories to create when module is enabled. |
|
82 | + // Example: this->dirs = array("/dav/temp","/dav/subdir"); |
|
83 | + $this->dirs = array(); |
|
84 | + |
|
85 | + // Config pages. Put here list of php page, stored into dav/admin directory, to use to setup module. |
|
86 | + $this->config_page_url = array("emailcollector_list.php"); |
|
87 | + |
|
88 | + // Dependencies |
|
89 | + $this->hidden = false; // A condition to hide module |
|
90 | + $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
93 | + $this->langfiles = array("admin"); |
|
94 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
95 | + $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module |
|
96 | + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
98 | + //$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
|
99 | + //$this->always_enabled = true; // If true, can't be disabled |
|
100 | + |
|
101 | + // Constants |
|
102 | + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
103 | + // Example: $this->const=array(0=>array('DAV_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
104 | + // 1=>array('DAV_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
|
105 | + // ); |
|
106 | + $this->const = array( |
|
107 | + //1=>array('DAV_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) |
|
108 | + ); |
|
109 | + |
|
110 | + |
|
111 | + if (! isset($conf->dav) || ! isset($conf->dav->enabled)) |
|
112 | + { |
|
113 | + $conf->dav=new stdClass(); |
|
114 | + $conf->dav->enabled=0; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + // Array to add new pages in new tabs |
|
119 | 119 | $this->tabs = array(); |
120 | - // Example: |
|
121 | - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 |
|
120 | + // Example: |
|
121 | + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 |
|
122 | 122 | // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. |
123 | 123 | // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname |
124 | 124 | // |
125 | 125 | // Where objecttype can be |
126 | - // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
127 | - // 'contact' to add a tab in contact view |
|
128 | - // 'contract' to add a tab in contract view |
|
129 | - // 'group' to add a tab in group view |
|
130 | - // 'intervention' to add a tab in intervention view |
|
131 | - // 'invoice' to add a tab in customer invoice view |
|
132 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
133 | - // 'member' to add a tab in fundation member view |
|
134 | - // 'opensurveypoll' to add a tab in opensurvey poll view |
|
135 | - // 'order' to add a tab in customer order view |
|
136 | - // 'order_supplier' to add a tab in supplier order view |
|
137 | - // 'payment' to add a tab in payment view |
|
138 | - // 'payment_supplier' to add a tab in supplier payment view |
|
139 | - // 'product' to add a tab in product view |
|
140 | - // 'propal' to add a tab in propal view |
|
141 | - // 'project' to add a tab in project view |
|
142 | - // 'stock' to add a tab in stock view |
|
143 | - // 'thirdparty' to add a tab in third party view |
|
144 | - // 'user' to add a tab in user view |
|
126 | + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
127 | + // 'contact' to add a tab in contact view |
|
128 | + // 'contract' to add a tab in contract view |
|
129 | + // 'group' to add a tab in group view |
|
130 | + // 'intervention' to add a tab in intervention view |
|
131 | + // 'invoice' to add a tab in customer invoice view |
|
132 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
133 | + // 'member' to add a tab in fundation member view |
|
134 | + // 'opensurveypoll' to add a tab in opensurvey poll view |
|
135 | + // 'order' to add a tab in customer order view |
|
136 | + // 'order_supplier' to add a tab in supplier order view |
|
137 | + // 'payment' to add a tab in payment view |
|
138 | + // 'payment_supplier' to add a tab in supplier payment view |
|
139 | + // 'product' to add a tab in product view |
|
140 | + // 'propal' to add a tab in propal view |
|
141 | + // 'project' to add a tab in project view |
|
142 | + // 'stock' to add a tab in stock view |
|
143 | + // 'thirdparty' to add a tab in third party view |
|
144 | + // 'user' to add a tab in user view |
|
145 | 145 | |
146 | 146 | |
147 | 147 | // Dictionaries |
148 | - $this->dictionaries=array(); |
|
148 | + $this->dictionaries=array(); |
|
149 | 149 | /* Example: |
150 | 150 | $this->dictionaries=array( |
151 | 151 | 'langs'=>'mylangfile@dav', |
@@ -163,25 +163,25 @@ discard block |
||
163 | 163 | |
164 | 164 | |
165 | 165 | // Boxes/Widgets |
166 | - // Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget. |
|
166 | + // Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget. |
|
167 | 167 | $this->boxes = array( |
168 | - //0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'), |
|
169 | - //1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'), |
|
170 | - //2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav') |
|
168 | + //0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'), |
|
169 | + //1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'), |
|
170 | + //2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav') |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | |
174 | - // Cronjobs (List of cron jobs entries to add when module is enabled) |
|
175 | - // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week |
|
176 | - $this->cronjobs = array( |
|
177 | - 0=>array('label'=>'Email collector', 'priority'=>50, 'jobtype'=>'method', 'class'=>'/emailcollector/class/emailcollector.class.php', 'objectname'=>'EmailCollector', 'method'=>'doCollect', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>5, 'unitfrequency'=>60, 'status'=>1, 'test'=>'$conf->emailcollector->enabled') |
|
178 | - ); |
|
174 | + // Cronjobs (List of cron jobs entries to add when module is enabled) |
|
175 | + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week |
|
176 | + $this->cronjobs = array( |
|
177 | + 0=>array('label'=>'Email collector', 'priority'=>50, 'jobtype'=>'method', 'class'=>'/emailcollector/class/emailcollector.class.php', 'objectname'=>'EmailCollector', 'method'=>'doCollect', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>5, 'unitfrequency'=>60, 'status'=>1, 'test'=>'$conf->emailcollector->enabled') |
|
178 | + ); |
|
179 | 179 | |
180 | 180 | |
181 | - // Permissions |
|
182 | - $this->rights = array(); // Permission array used by this module |
|
181 | + // Permissions |
|
182 | + $this->rights = array(); // Permission array used by this module |
|
183 | 183 | |
184 | - /* |
|
184 | + /* |
|
185 | 185 | $r=0; |
186 | 186 | $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) |
187 | 187 | $this->rights[$r][1] = 'Read myobject of dav'; // Permission label |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2) |
205 | 205 | */ |
206 | 206 | |
207 | - // Main menu entries |
|
208 | - $this->menu = array(); // List of menus to add |
|
209 | - $r=0; |
|
207 | + // Main menu entries |
|
208 | + $this->menu = array(); // List of menus to add |
|
209 | + $r=0; |
|
210 | 210 | |
211 | - // Add here entries to declare new menus |
|
211 | + // Add here entries to declare new menus |
|
212 | 212 | |
213 | - /* BEGIN MODULEBUILDER TOPMENU */ |
|
214 | - /*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
213 | + /* BEGIN MODULEBUILDER TOPMENU */ |
|
214 | + /*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
215 | 215 | 'type'=>'top', // This is a Top menu entry |
216 | 216 | 'titre'=>'dav', |
217 | 217 | 'mainmenu'=>'dav', |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | 'target'=>'', |
225 | 225 | 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
226 | 226 | */ |
227 | - /* END MODULEBUILDER TOPMENU */ |
|
227 | + /* END MODULEBUILDER TOPMENU */ |
|
228 | 228 | |
229 | - /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT |
|
229 | + /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT |
|
230 | 230 | $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=dav', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
231 | 231 | 'type'=>'left', // This is a Left menu entry |
232 | 232 | 'titre'=>'List MyObject', |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | END MODULEBUILDER LEFTMENU MYOBJECT */ |
255 | 255 | |
256 | 256 | |
257 | - // Exports |
|
258 | - $r=1; |
|
257 | + // Exports |
|
258 | + $r=1; |
|
259 | 259 | |
260 | - /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
|
261 | - /* |
|
260 | + /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
|
261 | + /* |
|
262 | 262 | $langs->load("dav@dav"); |
263 | 263 | $this->export_code[$r]=$this->rights_class.'_'.$r; |
264 | 264 | $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) |
@@ -273,48 +273,48 @@ discard block |
||
273 | 273 | $this->export_sql_end[$r] .=' WHERE 1 = 1'; |
274 | 274 | $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; |
275 | 275 | $r++; */ |
276 | - /* END MODULEBUILDER EXPORT MYOBJECT */ |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * Function called when module is enabled. |
|
281 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
282 | - * It also creates data directories |
|
283 | - * |
|
276 | + /* END MODULEBUILDER EXPORT MYOBJECT */ |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * Function called when module is enabled. |
|
281 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
282 | + * It also creates data directories |
|
283 | + * |
|
284 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
285 | + * @return int 1 if OK, 0 if KO |
|
286 | + */ |
|
287 | + public function init($options='') |
|
288 | + { |
|
289 | + //$this->_load_tables('/dav/sql/'); |
|
290 | + |
|
291 | + // Create extrafields |
|
292 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
293 | + $extrafields = new ExtraFields($this->db); |
|
294 | + |
|
295 | + //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
296 | + //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
297 | + //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
298 | + //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1 '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
299 | + //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
300 | + |
|
301 | + $sql = array(); |
|
302 | + |
|
303 | + return $this->_init($sql, $options); |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * Function called when module is disabled. |
|
308 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
309 | + * Data directories are not deleted |
|
310 | + * |
|
284 | 311 | * @param string $options Options when enabling module ('', 'noboxes') |
285 | - * @return int 1 if OK, 0 if KO |
|
286 | - */ |
|
287 | - public function init($options='') |
|
288 | - { |
|
289 | - //$this->_load_tables('/dav/sql/'); |
|
290 | - |
|
291 | - // Create extrafields |
|
292 | - include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
293 | - $extrafields = new ExtraFields($this->db); |
|
294 | - |
|
295 | - //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
296 | - //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
297 | - //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
298 | - //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1 '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
299 | - //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled'); |
|
300 | - |
|
301 | - $sql = array(); |
|
302 | - |
|
303 | - return $this->_init($sql, $options); |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * Function called when module is disabled. |
|
308 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
309 | - * Data directories are not deleted |
|
310 | - * |
|
311 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
312 | - * @return int 1 if OK, 0 if KO |
|
313 | - */ |
|
314 | - public function remove($options = '') |
|
315 | - { |
|
316 | - $sql = array(); |
|
317 | - |
|
318 | - return $this->_remove($sql, $options); |
|
319 | - } |
|
312 | + * @return int 1 if OK, 0 if KO |
|
313 | + */ |
|
314 | + public function remove($options = '') |
|
315 | + { |
|
316 | + $sql = array(); |
|
317 | + |
|
318 | + return $this->_remove($sql, $options); |
|
319 | + } |
|
320 | 320 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup dav |
24 | 24 | * \brief Description and activation file for module dav |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs, $conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); |
58 | 58 | |
59 | 59 | // Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module). |
60 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | 61 | // Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module). |
62 | 62 | $this->description = "EmailCollectorDescription"; |
63 | 63 | // Used only if file README.md and README-LL.md not found. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // Name of image file used for this module. |
71 | 71 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
72 | 72 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
73 | - $this->picto='email'; |
|
73 | + $this->picto = 'email'; |
|
74 | 74 | |
75 | 75 | // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
76 | 76 | // for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable) |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $this->config_page_url = array("emailcollector_list.php"); |
87 | 87 | |
88 | 88 | // Dependencies |
89 | - $this->hidden = false; // A condition to hide module |
|
90 | - $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
89 | + $this->hidden = false; // A condition to hide module |
|
90 | + $this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled |
|
91 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
92 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
93 | 93 | $this->langfiles = array("admin"); |
94 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
95 | - $this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module |
|
96 | - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
94 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
95 | + $this->need_dolibarr_version = array(7, 0); // Minimum version of Dolibarr required by module |
|
96 | + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
97 | + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
|
98 | 98 | //$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice'); |
99 | 99 | //$this->always_enabled = true; // If true, can't be disabled |
100 | 100 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | ); |
109 | 109 | |
110 | 110 | |
111 | - if (! isset($conf->dav) || ! isset($conf->dav->enabled)) |
|
111 | + if (!isset($conf->dav) || !isset($conf->dav->enabled)) |
|
112 | 112 | { |
113 | - $conf->dav=new stdClass(); |
|
114 | - $conf->dav->enabled=0; |
|
113 | + $conf->dav = new stdClass(); |
|
114 | + $conf->dav->enabled = 0; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | // Dictionaries |
148 | - $this->dictionaries=array(); |
|
148 | + $this->dictionaries = array(); |
|
149 | 149 | /* Example: |
150 | 150 | $this->dictionaries=array( |
151 | 151 | 'langs'=>'mylangfile@dav', |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | // Permissions |
182 | - $this->rights = array(); // Permission array used by this module |
|
182 | + $this->rights = array(); // Permission array used by this module |
|
183 | 183 | |
184 | 184 | /* |
185 | 185 | $r=0; |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | */ |
206 | 206 | |
207 | 207 | // Main menu entries |
208 | - $this->menu = array(); // List of menus to add |
|
209 | - $r=0; |
|
208 | + $this->menu = array(); // List of menus to add |
|
209 | + $r = 0; |
|
210 | 210 | |
211 | 211 | // Add here entries to declare new menus |
212 | 212 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | |
257 | 257 | // Exports |
258 | - $r=1; |
|
258 | + $r = 1; |
|
259 | 259 | |
260 | 260 | /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ |
261 | 261 | /* |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @param string $options Options when enabling module ('', 'noboxes') |
285 | 285 | * @return int 1 if OK, 0 if KO |
286 | 286 | */ |
287 | - public function init($options='') |
|
287 | + public function init($options = '') |
|
288 | 288 | { |
289 | 289 | //$this->_load_tables('/dav/sql/'); |
290 | 290 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | abstract class ModeleAction extends CommonDocGenerator |
30 | 30 | { |
31 | 31 | /** |
32 | - * @var string Error code (or message) |
|
33 | - */ |
|
34 | - public $error=''; |
|
32 | + * @var string Error code (or message) |
|
33 | + */ |
|
34 | + public $error=''; |
|
35 | 35 | |
36 | 36 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
37 | 37 | /** |
@@ -72,86 +72,86 @@ discard block |
||
72 | 72 | function action_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
73 | 73 | { |
74 | 74 | // phpcs:enable |
75 | - global $conf,$langs,$user; |
|
76 | - $langs->load("action"); |
|
77 | - |
|
78 | - $error=0; |
|
79 | - |
|
80 | - $srctemplatepath=''; |
|
81 | - |
|
82 | - // Positionne modele sur le nom du modele de fichinter a utiliser |
|
83 | - if (! dol_strlen($modele)) |
|
84 | - { |
|
85 | - if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
86 | - { |
|
87 | - $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
|
88 | - } |
|
89 | - else |
|
90 | - { |
|
91 | - $modele = 'soleil'; |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - // If selected modele is a filename template (then $modele="modelname:filename") |
|
96 | - $tmp=explode(':',$modele,2); |
|
75 | + global $conf,$langs,$user; |
|
76 | + $langs->load("action"); |
|
77 | + |
|
78 | + $error=0; |
|
79 | + |
|
80 | + $srctemplatepath=''; |
|
81 | + |
|
82 | + // Positionne modele sur le nom du modele de fichinter a utiliser |
|
83 | + if (! dol_strlen($modele)) |
|
84 | + { |
|
85 | + if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
86 | + { |
|
87 | + $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
|
88 | + } |
|
89 | + else |
|
90 | + { |
|
91 | + $modele = 'soleil'; |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + // If selected modele is a filename template (then $modele="modelname:filename") |
|
96 | + $tmp=explode(':',$modele,2); |
|
97 | 97 | if (! empty($tmp[1])) |
98 | 98 | { |
99 | 99 | $modele=$tmp[0]; |
100 | 100 | $srctemplatepath=$tmp[1]; |
101 | 101 | } |
102 | 102 | |
103 | - // Search template files |
|
104 | - $file=''; $classname=''; $filefound=0; |
|
105 | - $dirmodels=array('/'); |
|
106 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | - foreach($dirmodels as $reldir) |
|
108 | - { |
|
109 | - foreach(array('doc','pdf') as $prefix) |
|
110 | - { |
|
111 | - $file = $prefix."_".$modele.".modules.php"; |
|
112 | - |
|
113 | - // On verifie l'emplacement du modele |
|
114 | - $file=dol_buildpath($reldir."core/modules/action/doc/".$file,0); |
|
115 | - if (file_exists($file)) |
|
116 | - { |
|
117 | - $filefound=1; |
|
118 | - $classname=$prefix.'_'.$modele; |
|
119 | - break; |
|
120 | - } |
|
121 | - } |
|
122 | - if ($filefound) break; |
|
103 | + // Search template files |
|
104 | + $file=''; $classname=''; $filefound=0; |
|
105 | + $dirmodels=array('/'); |
|
106 | + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | + foreach($dirmodels as $reldir) |
|
108 | + { |
|
109 | + foreach(array('doc','pdf') as $prefix) |
|
110 | + { |
|
111 | + $file = $prefix."_".$modele.".modules.php"; |
|
112 | + |
|
113 | + // On verifie l'emplacement du modele |
|
114 | + $file=dol_buildpath($reldir."core/modules/action/doc/".$file,0); |
|
115 | + if (file_exists($file)) |
|
116 | + { |
|
117 | + $filefound=1; |
|
118 | + $classname=$prefix.'_'.$modele; |
|
119 | + break; |
|
120 | + } |
|
121 | + } |
|
122 | + if ($filefound) break; |
|
123 | 123 | } |
124 | 124 | |
125 | - // Charge le modele |
|
126 | - if ($filefound) |
|
127 | - { |
|
128 | - require_once $file; |
|
129 | - |
|
130 | - $obj = new $classname($db); |
|
131 | - |
|
132 | - // We save charset_output to restore it because write_file can change it if needed for |
|
133 | - // output format that does not support UTF8. |
|
134 | - $sav_charset_output=$outputlangs->charset_output; |
|
135 | - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
136 | - { |
|
137 | - $outputlangs->charset_output=$sav_charset_output; |
|
138 | - |
|
139 | - // We delete old preview |
|
140 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
141 | - dol_delete_preview($object); |
|
142 | - |
|
143 | - return 1; |
|
144 | - } |
|
145 | - else |
|
146 | - { |
|
147 | - $outputlangs->charset_output=$sav_charset_output; |
|
148 | - dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
|
149 | - return 0; |
|
150 | - } |
|
151 | - } |
|
152 | - else |
|
153 | - { |
|
154 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
155 | - return 0; |
|
156 | - } |
|
125 | + // Charge le modele |
|
126 | + if ($filefound) |
|
127 | + { |
|
128 | + require_once $file; |
|
129 | + |
|
130 | + $obj = new $classname($db); |
|
131 | + |
|
132 | + // We save charset_output to restore it because write_file can change it if needed for |
|
133 | + // output format that does not support UTF8. |
|
134 | + $sav_charset_output=$outputlangs->charset_output; |
|
135 | + if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
136 | + { |
|
137 | + $outputlangs->charset_output=$sav_charset_output; |
|
138 | + |
|
139 | + // We delete old preview |
|
140 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
141 | + dol_delete_preview($object); |
|
142 | + |
|
143 | + return 1; |
|
144 | + } |
|
145 | + else |
|
146 | + { |
|
147 | + $outputlangs->charset_output=$sav_charset_output; |
|
148 | + dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
|
149 | + return 0; |
|
150 | + } |
|
151 | + } |
|
152 | + else |
|
153 | + { |
|
154 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
155 | + return 0; |
|
156 | + } |
|
157 | 157 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @var string Error code (or message) |
33 | 33 | */ |
34 | - public $error=''; |
|
34 | + public $error = ''; |
|
35 | 35 | |
36 | 36 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
37 | 37 | /** |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | * @param integer $maxfilenamelength Max length of value to show |
42 | 42 | * @return array List of templates |
43 | 43 | */ |
44 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
44 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
45 | 45 | { |
46 | 46 | // phpcs:enable |
47 | 47 | global $conf; |
48 | 48 | |
49 | - $type='action'; |
|
50 | - $liste=array(); |
|
49 | + $type = 'action'; |
|
50 | + $liste = array(); |
|
51 | 51 | |
52 | 52 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
53 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
53 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
54 | 54 | |
55 | 55 | return $liste; |
56 | 56 | } |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | * @param int $hideref Hide ref |
70 | 70 | * @return int 0 if KO, 1 if OK |
71 | 71 | */ |
72 | -function action_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
|
72 | +function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
73 | 73 | { |
74 | 74 | // phpcs:enable |
75 | - global $conf,$langs,$user; |
|
75 | + global $conf, $langs, $user; |
|
76 | 76 | $langs->load("action"); |
77 | 77 | |
78 | - $error=0; |
|
78 | + $error = 0; |
|
79 | 79 | |
80 | - $srctemplatepath=''; |
|
80 | + $srctemplatepath = ''; |
|
81 | 81 | |
82 | 82 | // Positionne modele sur le nom du modele de fichinter a utiliser |
83 | - if (! dol_strlen($modele)) |
|
83 | + if (!dol_strlen($modele)) |
|
84 | 84 | { |
85 | - if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
85 | + if (!empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
|
86 | 86 | { |
87 | 87 | $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
88 | 88 | } |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // If selected modele is a filename template (then $modele="modelname:filename") |
96 | - $tmp=explode(':',$modele,2); |
|
97 | - if (! empty($tmp[1])) |
|
96 | + $tmp = explode(':', $modele, 2); |
|
97 | + if (!empty($tmp[1])) |
|
98 | 98 | { |
99 | - $modele=$tmp[0]; |
|
100 | - $srctemplatepath=$tmp[1]; |
|
99 | + $modele = $tmp[0]; |
|
100 | + $srctemplatepath = $tmp[1]; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Search template files |
104 | - $file=''; $classname=''; $filefound=0; |
|
105 | - $dirmodels=array('/'); |
|
106 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | - foreach($dirmodels as $reldir) |
|
104 | + $file = ''; $classname = ''; $filefound = 0; |
|
105 | + $dirmodels = array('/'); |
|
106 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
107 | + foreach ($dirmodels as $reldir) |
|
108 | 108 | { |
109 | - foreach(array('doc','pdf') as $prefix) |
|
109 | + foreach (array('doc', 'pdf') as $prefix) |
|
110 | 110 | { |
111 | 111 | $file = $prefix."_".$modele.".modules.php"; |
112 | 112 | |
113 | 113 | // On verifie l'emplacement du modele |
114 | - $file=dol_buildpath($reldir."core/modules/action/doc/".$file,0); |
|
114 | + $file = dol_buildpath($reldir."core/modules/action/doc/".$file, 0); |
|
115 | 115 | if (file_exists($file)) |
116 | 116 | { |
117 | - $filefound=1; |
|
118 | - $classname=$prefix.'_'.$modele; |
|
117 | + $filefound = 1; |
|
118 | + $classname = $prefix.'_'.$modele; |
|
119 | 119 | break; |
120 | 120 | } |
121 | 121 | } |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | |
132 | 132 | // We save charset_output to restore it because write_file can change it if needed for |
133 | 133 | // output format that does not support UTF8. |
134 | - $sav_charset_output=$outputlangs->charset_output; |
|
134 | + $sav_charset_output = $outputlangs->charset_output; |
|
135 | 135 | if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
136 | 136 | { |
137 | - $outputlangs->charset_output=$sav_charset_output; |
|
137 | + $outputlangs->charset_output = $sav_charset_output; |
|
138 | 138 | |
139 | 139 | // We delete old preview |
140 | 140 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | else |
146 | 146 | { |
147 | - $outputlangs->charset_output=$sav_charset_output; |
|
148 | - dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
|
147 | + $outputlangs->charset_output = $sav_charset_output; |
|
148 | + dol_print_error($db, "action_pdf_create Error: ".$obj->error); |
|
149 | 149 | return 0; |
150 | 150 | } |
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
154 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
154 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); |
|
155 | 155 | return 0; |
156 | 156 | } |
157 | 157 | } |
@@ -85,8 +85,7 @@ discard block |
||
85 | 85 | if (! empty($conf->global->ACTION_EVENT_ADDON_PDF)) |
86 | 86 | { |
87 | 87 | $modele = $conf->global->ACTION_EVENT_ADDON_PDF; |
88 | - } |
|
89 | - else |
|
88 | + } else |
|
90 | 89 | { |
91 | 90 | $modele = 'soleil'; |
92 | 91 | } |
@@ -103,7 +102,9 @@ discard block |
||
103 | 102 | // Search template files |
104 | 103 | $file=''; $classname=''; $filefound=0; |
105 | 104 | $dirmodels=array('/'); |
106 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
105 | + if (is_array($conf->modules_parts['models'])) { |
|
106 | + $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
107 | + } |
|
107 | 108 | foreach($dirmodels as $reldir) |
108 | 109 | { |
109 | 110 | foreach(array('doc','pdf') as $prefix) |
@@ -119,7 +120,9 @@ discard block |
||
119 | 120 | break; |
120 | 121 | } |
121 | 122 | } |
122 | - if ($filefound) break; |
|
123 | + if ($filefound) { |
|
124 | + break; |
|
125 | + } |
|
123 | 126 | } |
124 | 127 | |
125 | 128 | // Charge le modele |
@@ -141,15 +144,13 @@ discard block |
||
141 | 144 | dol_delete_preview($object); |
142 | 145 | |
143 | 146 | return 1; |
144 | - } |
|
145 | - else |
|
147 | + } else |
|
146 | 148 | { |
147 | 149 | $outputlangs->charset_output=$sav_charset_output; |
148 | 150 | dol_print_error($db,"action_pdf_create Error: ".$obj->error); |
149 | 151 | return 0; |
150 | 152 | } |
151 | - } |
|
152 | - else |
|
153 | + } else |
|
153 | 154 | { |
154 | 155 | print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
155 | 156 | return 0; |