@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup workflow |
24 | 24 | * \brief File to describe and activate module Workflow |
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 | /** |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | // Id for module (must be unique). |
45 | 45 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
46 | - $this->numero = 6000 ; |
|
46 | + $this->numero = 6000; |
|
47 | 47 | // Key text used to identify module (for permissions, menus, etc...) |
48 | 48 | $this->rights_class = 'workflow'; |
49 | 49 | |
50 | 50 | $this->family = "technic"; |
51 | 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
54 | 54 | $this->description = "Workflow management"; |
55 | 55 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // Name of png file (without png) used for this module. |
60 | 60 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
61 | 61 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
62 | - $this->picto='technic'; |
|
62 | + $this->picto = 'technic'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled |
65 | 65 | $this->dirs = array("/workflow/temp"); |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | $this->config_page_url = array('workflow.php'); |
69 | 69 | |
70 | 70 | // Dependencies |
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array(); // 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(2,8); // Minimum version of Dolibarr required by module |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array(); // 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(2, 8); // Minimum version of Dolibarr required by module |
|
77 | 77 | $this->langfiles = array("@workflow"); |
78 | 78 | |
79 | 79 | // Constants |
80 | 80 | // List of particular constants to add when module is enabled |
81 | 81 | //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), |
82 | 82 | // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); |
83 | - $this->const=array(); |
|
83 | + $this->const = array(); |
|
84 | 84 | |
85 | 85 | // Boxes |
86 | 86 | $this->boxes = array(); |
87 | 87 | |
88 | 88 | // Permissions |
89 | 89 | $this->rights = array(); |
90 | - $r=0; |
|
90 | + $r = 0; |
|
91 | 91 | |
92 | 92 | /* |
93 | 93 | $r++; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | |
101 | 101 | // Main menu entries |
102 | - $this->menus = array(); // List of menus to add |
|
103 | - $r=0; |
|
102 | + $this->menus = array(); // List of menus to add |
|
103 | + $r = 0; |
|
104 | 104 | /* |
105 | 105 | $this->menu[$r]=array('fk_menu'=>0, |
106 | 106 | 'type'=>'top', |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | * @param string $options Options when enabling module ('', 'noboxes') |
140 | 140 | * @return int 1 if OK, 0 if KO |
141 | 141 | */ |
142 | - function init($options='') |
|
142 | + function init($options = '') |
|
143 | 143 | { |
144 | 144 | // Permissions |
145 | 145 | $this->remove($options); |
146 | 146 | |
147 | 147 | $sql = array(); |
148 | 148 | |
149 | - return $this->_init($sql,$options); |
|
149 | + return $this->_init($sql, $options); |
|
150 | 150 | } |
151 | 151 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function __construct($db) |
49 | 49 | { |
50 | - global $conf,$langs,$mysoc; |
|
50 | + global $conf, $langs, $mysoc; |
|
51 | 51 | |
52 | 52 | // Load traductions files requiredby by page |
53 | 53 | $langs->loadLangs(array("main", "bills")); |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | |
60 | 60 | // Dimension page pour format A4 |
61 | 61 | $this->type = 'pdf'; |
62 | - $formatarray=pdf_getFormat(); |
|
62 | + $formatarray = pdf_getFormat(); |
|
63 | 63 | $this->page_largeur = $formatarray['width']; |
64 | 64 | $this->page_hauteur = $formatarray['height']; |
65 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
66 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
67 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
68 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
69 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
65 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
66 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
67 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
68 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
69 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
70 | 70 | |
71 | 71 | // Recupere emmetteur |
72 | - $this->emetteur=$mysoc; |
|
73 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
72 | + $this->emetteur = $mysoc; |
|
73 | + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
74 | 74 | |
75 | 75 | // Defini position des colonnes |
76 | 76 | $this->line_height = 5; |
77 | 77 | $this->line_per_page = 40; |
78 | - $this->tab_height = 200; //$this->line_height * $this->line_per_page; |
|
78 | + $this->tab_height = 200; //$this->line_height * $this->line_per_page; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -91,49 +91,49 @@ discard block |
||
91 | 91 | function write_file($object, $_dir, $number, $outputlangs) |
92 | 92 | { |
93 | 93 | // phpcs:enable |
94 | - global $user,$conf,$langs,$hookmanager; |
|
94 | + global $user, $conf, $langs, $hookmanager; |
|
95 | 95 | |
96 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
96 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
97 | 97 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
98 | - $sav_charset_output=$outputlangs->charset_output; |
|
99 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
98 | + $sav_charset_output = $outputlangs->charset_output; |
|
99 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
100 | 100 | |
101 | 101 | // Load traductions files requiredby by page |
102 | 102 | $outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta")); |
103 | 103 | |
104 | - $dir = $_dir . "/".get_exdir($number,0,1,0,$object,'cheque').$number; |
|
104 | + $dir = $_dir."/".get_exdir($number, 0, 1, 0, $object, 'cheque').$number; |
|
105 | 105 | |
106 | - if (! is_dir($dir)) |
|
106 | + if (!is_dir($dir)) |
|
107 | 107 | { |
108 | - $result=dol_mkdir($dir); |
|
108 | + $result = dol_mkdir($dir); |
|
109 | 109 | |
110 | 110 | if ($result < 0) |
111 | 111 | { |
112 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
112 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
113 | 113 | return -1; |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - $file = $dir . "/bordereau-".$number.".pdf"; |
|
117 | + $file = $dir."/bordereau-".$number.".pdf"; |
|
118 | 118 | |
119 | 119 | // Add pdfgeneration hook |
120 | - if (! is_object($hookmanager)) |
|
120 | + if (!is_object($hookmanager)) |
|
121 | 121 | { |
122 | 122 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
123 | - $hookmanager=new HookManager($this->db); |
|
123 | + $hookmanager = new HookManager($this->db); |
|
124 | 124 | } |
125 | 125 | $hookmanager->initHooks(array('pdfgeneration')); |
126 | - $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
126 | + $parameters = array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
127 | 127 | global $action; |
128 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
128 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
129 | 129 | |
130 | 130 | // Create PDF instance |
131 | - $pdf=pdf_getInstance($this->format); |
|
132 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
133 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
134 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
135 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
136 | - $pdf->SetAutoPageBreak(1,0); |
|
131 | + $pdf = pdf_getInstance($this->format); |
|
132 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
133 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
134 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
135 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
136 | + $pdf->SetAutoPageBreak(1, 0); |
|
137 | 137 | |
138 | 138 | if (class_exists('TCPDF')) |
139 | 139 | { |
@@ -143,23 +143,23 @@ discard block |
||
143 | 143 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
144 | 144 | |
145 | 145 | $pdf->Open(); |
146 | - $pagenb=0; |
|
147 | - $pdf->SetDrawColor(128,128,128); |
|
146 | + $pagenb = 0; |
|
147 | + $pdf->SetDrawColor(128, 128, 128); |
|
148 | 148 | |
149 | 149 | $pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number); |
150 | 150 | $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); |
151 | 151 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
152 | 152 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
153 | 153 | $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); |
154 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
154 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
155 | 155 | |
156 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
156 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
157 | 157 | |
158 | - $nboflines=count($this->lines); |
|
158 | + $nboflines = count($this->lines); |
|
159 | 159 | |
160 | 160 | // Define nb of page |
161 | 161 | $pages = intval($nboflines / $this->line_per_page); |
162 | - if (($nboflines % $this->line_per_page)>0) |
|
162 | + if (($nboflines % $this->line_per_page) > 0) |
|
163 | 163 | { |
164 | 164 | $pages++; |
165 | 165 | } |
@@ -176,31 +176,31 @@ discard block |
||
176 | 176 | $this->Body($pdf, $pagenb, $pages, $outputlangs); |
177 | 177 | |
178 | 178 | // Pied de page |
179 | - $this->_pagefoot($pdf,'',$outputlangs); |
|
180 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
179 | + $this->_pagefoot($pdf, '', $outputlangs); |
|
180 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
181 | 181 | |
182 | 182 | $pdf->Close(); |
183 | 183 | |
184 | - $pdf->Output($file,'F'); |
|
184 | + $pdf->Output($file, 'F'); |
|
185 | 185 | |
186 | 186 | // Add pdfgeneration hook |
187 | - if (! is_object($hookmanager)) |
|
187 | + if (!is_object($hookmanager)) |
|
188 | 188 | { |
189 | 189 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
190 | - $hookmanager=new HookManager($this->db); |
|
190 | + $hookmanager = new HookManager($this->db); |
|
191 | 191 | } |
192 | 192 | $hookmanager->initHooks(array('pdfgeneration')); |
193 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
193 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
194 | 194 | global $action; |
195 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
195 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
196 | 196 | |
197 | - if (! empty($conf->global->MAIN_UMASK)) |
|
197 | + if (!empty($conf->global->MAIN_UMASK)) |
|
198 | 198 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
199 | 199 | |
200 | 200 | $this->result = array('fullpath'=>$file); |
201 | 201 | |
202 | - $outputlangs->charset_output=$sav_charset_output; |
|
203 | - return 1; // Pas d'erreur |
|
202 | + $outputlangs->charset_output = $sav_charset_output; |
|
203 | + return 1; // Pas d'erreur |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -224,38 +224,38 @@ discard block |
||
224 | 224 | $outputlangs->loadLangs(array("compta", "banks")); |
225 | 225 | |
226 | 226 | $title = $outputlangs->transnoentities("CheckReceipt"); |
227 | - $pdf->SetFont('','B', $default_font_size); |
|
228 | - $pdf->SetXY(10,8); |
|
229 | - $pdf->MultiCell(0,2,$title,0,'L'); |
|
230 | - |
|
231 | - $pdf->SetFont('','', $default_font_size); |
|
232 | - $pdf->SetXY(10,15); |
|
233 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Ref"),0,'L'); |
|
234 | - $pdf->SetXY(32,15); |
|
235 | - $pdf->SetFont('','', $default_font_size); |
|
236 | - $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext?" - ".$this->ref_ext:'')), 0, 'L'); |
|
237 | - |
|
238 | - $pdf->SetFont('','', $default_font_size); |
|
239 | - $pdf->SetXY(10,20); |
|
240 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Date"),0,'L'); |
|
241 | - $pdf->SetXY(32,20); |
|
242 | - $pdf->SetFont('','', $default_font_size); |
|
243 | - $pdf->MultiCell(60, 2, dol_print_date($this->date,"day",false,$outputlangs)); |
|
244 | - |
|
245 | - $pdf->SetFont('','', $default_font_size); |
|
246 | - $pdf->SetXY(10,26); |
|
247 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Owner"),0,'L'); |
|
248 | - $pdf->SetFont('','', $default_font_size); |
|
249 | - $pdf->SetXY(32,26); |
|
250 | - $pdf->MultiCell(60,2,$outputlangs->convToOutputCharset($this->account->proprio),0,'L'); |
|
251 | - |
|
252 | - $pdf->SetFont('','', $default_font_size); |
|
253 | - $pdf->SetXY(10,32); |
|
254 | - $pdf->MultiCell(0,2,$outputlangs->transnoentities("Account"),0,'L'); |
|
255 | - pdf_bank($pdf,$outputlangs,32,32,$this->account,1); |
|
256 | - |
|
257 | - $pdf->SetFont('','', $default_font_size); |
|
258 | - $pdf->SetXY(114,15); |
|
227 | + $pdf->SetFont('', 'B', $default_font_size); |
|
228 | + $pdf->SetXY(10, 8); |
|
229 | + $pdf->MultiCell(0, 2, $title, 0, 'L'); |
|
230 | + |
|
231 | + $pdf->SetFont('', '', $default_font_size); |
|
232 | + $pdf->SetXY(10, 15); |
|
233 | + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Ref"), 0, 'L'); |
|
234 | + $pdf->SetXY(32, 15); |
|
235 | + $pdf->SetFont('', '', $default_font_size); |
|
236 | + $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext ? " - ".$this->ref_ext : '')), 0, 'L'); |
|
237 | + |
|
238 | + $pdf->SetFont('', '', $default_font_size); |
|
239 | + $pdf->SetXY(10, 20); |
|
240 | + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Date"), 0, 'L'); |
|
241 | + $pdf->SetXY(32, 20); |
|
242 | + $pdf->SetFont('', '', $default_font_size); |
|
243 | + $pdf->MultiCell(60, 2, dol_print_date($this->date, "day", false, $outputlangs)); |
|
244 | + |
|
245 | + $pdf->SetFont('', '', $default_font_size); |
|
246 | + $pdf->SetXY(10, 26); |
|
247 | + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Owner"), 0, 'L'); |
|
248 | + $pdf->SetFont('', '', $default_font_size); |
|
249 | + $pdf->SetXY(32, 26); |
|
250 | + $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L'); |
|
251 | + |
|
252 | + $pdf->SetFont('', '', $default_font_size); |
|
253 | + $pdf->SetXY(10, 32); |
|
254 | + $pdf->MultiCell(0, 2, $outputlangs->transnoentities("Account"), 0, 'L'); |
|
255 | + pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1); |
|
256 | + |
|
257 | + $pdf->SetFont('', '', $default_font_size); |
|
258 | + $pdf->SetXY(114, 15); |
|
259 | 259 | $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Signature"), 0, 'L'); |
260 | 260 | |
261 | 261 | $pdf->Rect(9, 14, 192, 35); |
@@ -268,44 +268,44 @@ discard block |
||
268 | 268 | $pdf->line(112, 14, 112, 49); |
269 | 269 | |
270 | 270 | // Number of cheques |
271 | - $posy=51; |
|
271 | + $posy = 51; |
|
272 | 272 | $pdf->Rect(9, $posy, 192, 6); |
273 | - $pdf->line(55, $posy, 55, $posy+6); |
|
274 | - $pdf->line(140, $posy, 140, $posy+6); |
|
275 | - $pdf->line(170, $posy, 170, $posy+6); |
|
273 | + $pdf->line(55, $posy, 55, $posy + 6); |
|
274 | + $pdf->line(140, $posy, 140, $posy + 6); |
|
275 | + $pdf->line(170, $posy, 170, $posy + 6); |
|
276 | 276 | |
277 | - $pdf->SetFont('','', $default_font_size); |
|
278 | - $pdf->SetXY(10,$posy+1); |
|
277 | + $pdf->SetFont('', '', $default_font_size); |
|
278 | + $pdf->SetXY(10, $posy + 1); |
|
279 | 279 | $pdf->MultiCell(40, 2, $outputlangs->transnoentities("NumberOfCheques"), 0, 'L'); |
280 | 280 | |
281 | - $pdf->SetFont('','B', $default_font_size); |
|
282 | - $pdf->SetXY(57,$posy+1); |
|
281 | + $pdf->SetFont('', 'B', $default_font_size); |
|
282 | + $pdf->SetXY(57, $posy + 1); |
|
283 | 283 | $pdf->MultiCell(40, 2, $this->nbcheque, 0, 'L'); |
284 | 284 | |
285 | - $pdf->SetFont('','', $default_font_size); |
|
286 | - $pdf->SetXY(148,$posy+1); |
|
285 | + $pdf->SetFont('', '', $default_font_size); |
|
286 | + $pdf->SetXY(148, $posy + 1); |
|
287 | 287 | $pdf->MultiCell(40, 2, $langs->trans("Total")); |
288 | 288 | |
289 | - $pdf->SetFont('','B', $default_font_size); |
|
290 | - $pdf->SetXY(170, $posy+1); |
|
289 | + $pdf->SetFont('', 'B', $default_font_size); |
|
290 | + $pdf->SetXY(170, $posy + 1); |
|
291 | 291 | $pdf->MultiCell(31, 2, price($this->amount), 0, 'C', 0); |
292 | 292 | |
293 | 293 | // Tableau |
294 | - $pdf->SetFont('','', $default_font_size - 2); |
|
295 | - $pdf->SetXY(11, $this->tab_top+2); |
|
296 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("Num"), 0, 'L'); |
|
294 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
295 | + $pdf->SetXY(11, $this->tab_top + 2); |
|
296 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Num"), 0, 'L'); |
|
297 | 297 | $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); |
298 | 298 | |
299 | - $pdf->SetXY(41, $this->tab_top+2); |
|
300 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("Bank"), 0, 'L'); |
|
299 | + $pdf->SetXY(41, $this->tab_top + 2); |
|
300 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Bank"), 0, 'L'); |
|
301 | 301 | $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10); |
302 | 302 | |
303 | - $pdf->SetXY(101, $this->tab_top+2); |
|
304 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("CheckTransmitter"), 0, 'L'); |
|
303 | + $pdf->SetXY(101, $this->tab_top + 2); |
|
304 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("CheckTransmitter"), 0, 'L'); |
|
305 | 305 | $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10); |
306 | 306 | |
307 | - $pdf->SetXY(180, $this->tab_top+2); |
|
308 | - $pdf->MultiCell(20,2,$outputlangs->transnoentities("Amount"), 0, 'R'); |
|
307 | + $pdf->SetXY(180, $this->tab_top + 2); |
|
308 | + $pdf->MultiCell(20, 2, $outputlangs->transnoentities("Amount"), 0, 'R'); |
|
309 | 309 | $pdf->line(9, $this->tab_top + 8, 201, $this->tab_top + 8); |
310 | 310 | |
311 | 311 | $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); |
@@ -329,44 +329,44 @@ discard block |
||
329 | 329 | // x=30 - Banque |
330 | 330 | // x=100 - Emetteur |
331 | 331 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
332 | - $pdf->SetFont('','', $default_font_size - 1); |
|
332 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
333 | 333 | $oldprowid = 0; |
334 | - $pdf->SetFillColor(220,220,220); |
|
334 | + $pdf->SetFillColor(220, 220, 220); |
|
335 | 335 | $yp = 0; |
336 | - $lineinpage=0; |
|
337 | - $num=count($this->lines); |
|
336 | + $lineinpage = 0; |
|
337 | + $num = count($this->lines); |
|
338 | 338 | for ($j = 0; $j < $num; $j++) |
339 | 339 | { |
340 | 340 | $lineinpage++; |
341 | 341 | |
342 | 342 | $pdf->SetXY(1, $this->tab_top + 10 + $yp); |
343 | - $pdf->MultiCell(8, $this->line_height, $j+1, 0, 'R', 0); |
|
343 | + $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0); |
|
344 | 344 | |
345 | 345 | $pdf->SetXY(10, $this->tab_top + 10 + $yp); |
346 | - $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq?$this->lines[$j]->num_chq:'', 0, 'L', 0); |
|
346 | + $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : '', 0, 'L', 0); |
|
347 | 347 | |
348 | 348 | $pdf->SetXY(40, $this->tab_top + 10 + $yp); |
349 | - $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq),44), 0, 'L', 0); |
|
349 | + $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq), 44), 0, 'L', 0); |
|
350 | 350 | |
351 | 351 | $pdf->SetXY(100, $this->tab_top + 10 + $yp); |
352 | - $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq),50), 0, 'L', 0); |
|
352 | + $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq), 50), 0, 'L', 0); |
|
353 | 353 | |
354 | 354 | $pdf->SetXY(180, $this->tab_top + 10 + $yp); |
355 | 355 | $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); |
356 | 356 | |
357 | 357 | $yp = $yp + $this->line_height; |
358 | 358 | |
359 | - if ($lineinpage >= $this->line_per_page && $j < (count($this->lines)-1)) |
|
359 | + if ($lineinpage >= $this->line_per_page && $j < (count($this->lines) - 1)) |
|
360 | 360 | { |
361 | - $lineinpage=0; $yp=0; |
|
361 | + $lineinpage = 0; $yp = 0; |
|
362 | 362 | |
363 | 363 | // New page |
364 | 364 | $pdf->AddPage(); |
365 | 365 | $pagenb++; |
366 | 366 | $this->Header($pdf, $pagenb, $pages, $outputlangs); |
367 | - $pdf->SetFont('','', $default_font_size - 1); |
|
368 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
369 | - $pdf->SetTextColor(0,0,0); |
|
367 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
368 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
369 | + $pdf->SetTextColor(0, 0, 0); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
@@ -381,21 +381,21 @@ discard block |
||
381 | 381 | * @param int $hidefreetext 1=Hide free text |
382 | 382 | * @return void |
383 | 383 | */ |
384 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
384 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
385 | 385 | { |
386 | 386 | global $conf; |
387 | 387 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
388 | 388 | |
389 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
389 | + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
390 | 390 | |
391 | 391 | // Line of free text |
392 | - $newfreetext=''; |
|
393 | - $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; |
|
394 | - if (! empty($conf->global->$paramfreetext)) |
|
392 | + $newfreetext = ''; |
|
393 | + $paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT'; |
|
394 | + if (!empty($conf->global->$paramfreetext)) |
|
395 | 395 | { |
396 | - $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); |
|
396 | + $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); |
|
397 | 397 | } |
398 | 398 | |
399 | - return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
399 | + return pdf_pagefoot($pdf, $outputlangs, $newfreetext, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
400 | 400 | } |
401 | 401 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \brief File containing class for numbering module Mint |
23 | 23 | */ |
24 | 24 | |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/cheque/modules_chequereceipts.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class to manage cheque receipts numbering rules Mint |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | * Dolibarr version of the loaded document |
34 | 34 | * @public string |
35 | 35 | */ |
36 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
36 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | 37 | |
38 | - public $prefix='CHK'; |
|
38 | + public $prefix = 'CHK'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var string Error code (or message) |
42 | 42 | */ |
43 | - public $error=''; |
|
43 | + public $error = ''; |
|
44 | 44 | |
45 | - public $name='Mint'; |
|
45 | + public $name = 'Mint'; |
|
46 | 46 | |
47 | 47 | |
48 | 48 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | function info() |
54 | 54 | { |
55 | 55 | global $langs; |
56 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
56 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -76,26 +76,26 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function canBeActivated() |
78 | 78 | { |
79 | - global $conf,$langs,$db; |
|
79 | + global $conf, $langs, $db; |
|
80 | 80 | |
81 | - $payyymm=''; $max=''; |
|
81 | + $payyymm = ''; $max = ''; |
|
82 | 82 | |
83 | - $posindice=9; |
|
83 | + $posindice = 9; |
|
84 | 84 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
85 | - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
86 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
87 | - $sql.= " AND entity = ".$conf->entity; |
|
85 | + $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
86 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
87 | + $sql .= " AND entity = ".$conf->entity; |
|
88 | 88 | |
89 | - $resql=$db->query($sql); |
|
89 | + $resql = $db->query($sql); |
|
90 | 90 | if ($resql) |
91 | 91 | { |
92 | 92 | $row = $db->fetch_row($resql); |
93 | - if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; } |
|
93 | + if ($row) { $payyymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
94 | 94 | } |
95 | - if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm)) |
|
95 | + if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) |
|
96 | 96 | { |
97 | 97 | $langs->load("errors"); |
98 | - $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
98 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | |
@@ -109,23 +109,23 @@ discard block |
||
109 | 109 | * @param Object $object Object we need next value for |
110 | 110 | * @return string Value if KO, <0 if KO |
111 | 111 | */ |
112 | - function getNextValue($objsoc,$object) |
|
112 | + function getNextValue($objsoc, $object) |
|
113 | 113 | { |
114 | - global $db,$conf; |
|
114 | + global $db, $conf; |
|
115 | 115 | |
116 | 116 | // D'abord on recupere la valeur max |
117 | - $posindice=9; |
|
117 | + $posindice = 9; |
|
118 | 118 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
119 | - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
120 | - $sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; |
|
121 | - $sql.= " AND entity = ".$conf->entity; |
|
119 | + $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
120 | + $sql .= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; |
|
121 | + $sql .= " AND entity = ".$conf->entity; |
|
122 | 122 | |
123 | - $resql=$db->query($sql); |
|
123 | + $resql = $db->query($sql); |
|
124 | 124 | if ($resql) |
125 | 125 | { |
126 | 126 | $obj = $db->fetch_object($resql); |
127 | 127 | if ($obj) $max = intval($obj->max); |
128 | - else $max=0; |
|
128 | + else $max = 0; |
|
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | //$date=time(); |
137 | - $date=$object->date_bordereau; |
|
138 | - $yymm = strftime("%y%m",$date); |
|
137 | + $date = $object->date_bordereau; |
|
138 | + $yymm = strftime("%y%m", $date); |
|
139 | 139 | |
140 | - 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 |
|
141 | - else $num = sprintf("%04s",$max+1); |
|
140 | + 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 |
|
141 | + else $num = sprintf("%04s", $max + 1); |
|
142 | 142 | |
143 | 143 | dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); |
144 | 144 | return $this->prefix.$yymm."-".$num; |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | * @param string $objforref Object for number to search |
154 | 154 | * @return string Next free value |
155 | 155 | */ |
156 | - function chequereceipt_get_num($objsoc,$objforref) |
|
156 | + function chequereceipt_get_num($objsoc, $objforref) |
|
157 | 157 | { |
158 | 158 | // phpcs:enable |
159 | - return $this->getNextValue($objsoc,$objforref); |
|
159 | + return $this->getNextValue($objsoc, $objforref); |
|
160 | 160 | } |
161 | 161 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \brief File containing class for numbering module Thyme |
23 | 23 | */ |
24 | 24 | |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/cheque/modules_chequereceipts.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * Dolibarr version of the loaded document |
35 | 35 | * @public string |
36 | 36 | */ |
37 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @var string Error message |
@@ -58,28 +58,28 @@ discard block |
||
58 | 58 | $form = new Form($this->db); |
59 | 59 | |
60 | 60 | $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
61 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
62 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
63 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
64 | - $texte.= '<input type="hidden" name="maskconstchequereceipts" value="CHEQUERECEIPTS_THYME_MASK">'; |
|
65 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
66 | - |
|
67 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
68 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
69 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
70 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
71 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
61 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
62 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
63 | + $texte .= '<input type="hidden" name="action" value="updateMask">'; |
|
64 | + $texte .= '<input type="hidden" name="maskconstchequereceipts" value="CHEQUERECEIPTS_THYME_MASK">'; |
|
65 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
66 | + |
|
67 | + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("CheckReceiptShort"), $langs->transnoentities("CheckReceiptShort")); |
|
68 | + $tooltip .= $langs->trans("GenericMaskCodes2"); |
|
69 | + $tooltip .= $langs->trans("GenericMaskCodes3"); |
|
70 | + $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CheckReceiptShort"), $langs->transnoentities("CheckReceiptShort")); |
|
71 | + $tooltip .= $langs->trans("GenericMaskCodes5"); |
|
72 | 72 | |
73 | 73 | // Parametrage du prefix |
74 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
75 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskchequereceipts" value="'.$conf->global->CHEQUERECEIPTS_THYME_MASK.'">',$tooltip,1,1).'</td>'; |
|
74 | + $texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
75 | + $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskchequereceipts" value="'.$conf->global->CHEQUERECEIPTS_THYME_MASK.'">', $tooltip, 1, 1).'</td>'; |
|
76 | 76 | |
77 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
77 | + $texte .= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
78 | 78 | |
79 | - $texte.= '</tr>'; |
|
79 | + $texte .= '</tr>'; |
|
80 | 80 | |
81 | - $texte.= '</table>'; |
|
82 | - $texte.= '</form>'; |
|
81 | + $texte .= '</table>'; |
|
82 | + $texte .= '</form>'; |
|
83 | 83 | |
84 | 84 | return $texte; |
85 | 85 | } |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | */ |
92 | 92 | function getExample() |
93 | 93 | { |
94 | - global $conf,$langs,$mysoc; |
|
94 | + global $conf, $langs, $mysoc; |
|
95 | 95 | |
96 | - $old_code_client=$mysoc->code_client; |
|
97 | - $mysoc->code_client='CCCCCCCCCC'; |
|
98 | - $numExample = $this->getNextValue($mysoc,''); |
|
99 | - $mysoc->code_client=$old_code_client; |
|
96 | + $old_code_client = $mysoc->code_client; |
|
97 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
98 | + $numExample = $this->getNextValue($mysoc, ''); |
|
99 | + $mysoc->code_client = $old_code_client; |
|
100 | 100 | |
101 | - if (! $numExample) |
|
101 | + if (!$numExample) |
|
102 | 102 | { |
103 | 103 | $numExample = $langs->trans('NotConfigured'); |
104 | 104 | } |
@@ -112,22 +112,22 @@ discard block |
||
112 | 112 | * @param Object $object Object we need next value for |
113 | 113 | * @return string Value if KO, <0 if KO |
114 | 114 | */ |
115 | - function getNextValue($objsoc,$object) |
|
115 | + function getNextValue($objsoc, $object) |
|
116 | 116 | { |
117 | - global $db,$conf; |
|
117 | + global $db, $conf; |
|
118 | 118 | |
119 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
119 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
120 | 120 | |
121 | 121 | // We get cursor rule |
122 | - $mask=$conf->global->CHEQUERECEIPTS_THYME_MASK; |
|
122 | + $mask = $conf->global->CHEQUERECEIPTS_THYME_MASK; |
|
123 | 123 | |
124 | - if (! $mask) |
|
124 | + if (!$mask) |
|
125 | 125 | { |
126 | - $this->error='NotConfigured'; |
|
126 | + $this->error = 'NotConfigured'; |
|
127 | 127 | return 0; |
128 | 128 | } |
129 | 129 | |
130 | - $numFinal=get_next_value($db,$mask,'bordereau_cheque','ref','',$objsoc,$object->date_bordereau); |
|
130 | + $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, $object->date_bordereau); |
|
131 | 131 | |
132 | 132 | return $numFinal; |
133 | 133 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * @param string $objforref Object for number to search |
142 | 142 | * @return string Next free value |
143 | 143 | */ |
144 | - function chequereceipt_get_num($objsoc,$objforref) |
|
144 | + function chequereceipt_get_num($objsoc, $objforref) |
|
145 | 145 | { |
146 | 146 | // phpcs:enable |
147 | - return $this->getNextValue($objsoc,$objforref); |
|
147 | + return $this->getNextValue($objsoc, $objforref); |
|
148 | 148 | } |
149 | 149 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
31 | -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent |
|
31 | +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * \class ModeleNumRefChequeReceipts |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @var string Error code (or message) |
41 | 41 | */ |
42 | - public $error=''; |
|
42 | + public $error = ''; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Return if a module can be used or not |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param Object $object Object we need next value for |
93 | 93 | * @return string Valeur |
94 | 94 | */ |
95 | - function getNextValue($objsoc,$object) |
|
95 | + function getNextValue($objsoc, $object) |
|
96 | 96 | { |
97 | 97 | global $langs; |
98 | 98 | return $langs->trans("NotAvailable"); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @var string Error code (or message) |
127 | 127 | */ |
128 | - public $error=''; |
|
128 | + public $error = ''; |
|
129 | 129 | |
130 | 130 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
131 | 131 | /** |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | * @param integer $maxfilenamelength Max length of value to show |
136 | 136 | * @return array List of templates |
137 | 137 | */ |
138 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
138 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
139 | 139 | { |
140 | 140 | // phpcs:enable |
141 | 141 | global $conf; |
142 | 142 | |
143 | - $type='chequereceipt'; |
|
144 | - $liste=array(); |
|
143 | + $type = 'chequereceipt'; |
|
144 | + $liste = array(); |
|
145 | 145 | |
146 | 146 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
147 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
147 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
148 | 148 | // TODO Remove this to use getListOfModels only |
149 | 149 | $liste = array('blochet'=>'blochet'); |
150 | 150 | |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) |
168 | 168 | { |
169 | - global $conf,$langs; |
|
169 | + global $conf, $langs; |
|
170 | 170 | $langs->load("bills"); |
171 | 171 | |
172 | - $dir = DOL_DOCUMENT_ROOT . "/core/modules/cheque/doc/"; |
|
172 | + $dir = DOL_DOCUMENT_ROOT."/core/modules/cheque/doc/"; |
|
173 | 173 | |
174 | 174 | // Positionne modele sur le nom du modele a utiliser |
175 | - if (! dol_strlen($modele)) |
|
175 | + if (!dol_strlen($modele)) |
|
176 | 176 | { |
177 | - if (! empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
|
177 | + if (!empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
|
178 | 178 | { |
179 | 179 | $modele = $conf->global->CHEQUERECEIPT_ADDON_PDF; |
180 | 180 | } |
@@ -197,22 +197,22 @@ discard block |
||
197 | 197 | |
198 | 198 | // We save charset_output to restore it because write_file can change it if needed for |
199 | 199 | // output format that does not support UTF8. |
200 | - $sav_charset_output=$outputlangs->charset_output; |
|
200 | + $sav_charset_output = $outputlangs->charset_output; |
|
201 | 201 | if ($obj->write_file($id, $outputlangs) > 0) |
202 | 202 | { |
203 | - $outputlangs->charset_output=$sav_charset_output; |
|
203 | + $outputlangs->charset_output = $sav_charset_output; |
|
204 | 204 | return 1; |
205 | 205 | } |
206 | 206 | else |
207 | 207 | { |
208 | - $outputlangs->charset_output=$sav_charset_output; |
|
209 | - dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error); |
|
208 | + $outputlangs->charset_output = $sav_charset_output; |
|
209 | + dol_print_error($db, "chequereceipt_pdf_create Error: ".$obj->error); |
|
210 | 210 | return -1; |
211 | 211 | } |
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
215 | - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file)); |
|
215 | + dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $dir.$file)); |
|
216 | 216 | return -1; |
217 | 217 | } |
218 | 218 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup printing |
26 | 26 | * \brief File of class to describe and activate module Direct Printing |
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 | |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function __construct($db) |
44 | 44 | { |
45 | - $this->db = $db ; |
|
45 | + $this->db = $db; |
|
46 | 46 | $this->numero = 64000; |
47 | 47 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
48 | 48 | // It is used to group modules in module setup page |
49 | 49 | $this->family = "interface"; |
50 | 50 | $this->module_position = '52'; |
51 | 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
54 | 54 | $this->description = "Enable Direct Printing System."; |
55 | - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version |
|
55 | + $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version |
|
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | 58 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | $this->config_page_url = array("printing.php@printing"); |
67 | 67 | |
68 | 68 | // Dependencies |
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | - $this->need_dolibarr_version = array(3,7,-2); // Minimum version of Dolibarr required by module |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
74 | + $this->need_dolibarr_version = array(3, 7, -2); // Minimum version of Dolibarr required by module |
|
75 | 75 | $this->conflictwith = array(); |
76 | 76 | $this->langfiles = array("printing"); |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $this->rights = array(); |
86 | 86 | $this->rights_class = 'printing'; |
87 | 87 | |
88 | - $r=0; |
|
88 | + $r = 0; |
|
89 | 89 | // $this->rights[$r][0] Id permission (unique tous modules confondus) |
90 | 90 | // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
91 | 91 | // $this->rights[$r][2] Non utilise |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | $this->rights[$r][4] = 'read'; |
102 | 102 | |
103 | 103 | // Main menu entries |
104 | - $this->menus = array(); // List of menus to add |
|
105 | - $r=0; |
|
104 | + $this->menus = array(); // List of menus to add |
|
105 | + $r = 0; |
|
106 | 106 | |
107 | 107 | // This is to declare the Top Menu entry: |
108 | - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu |
|
109 | - 'type'=>'left', // This is a Top menu entry |
|
108 | + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu |
|
109 | + 'type'=>'left', // This is a Top menu entry |
|
110 | 110 | 'titre'=>'MenuDirectPrinting', |
111 | 111 | 'url'=>'/printing/index.php?mainmenu=home&leftmenu=admintools', |
112 | - 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
112 | + 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
113 | 113 | 'position'=>300, |
114 | 114 | 'enabled'=>'$conf->printing->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', |
115 | - 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules |
|
115 | + 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules |
|
116 | 116 | 'target'=>'', |
117 | - 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both |
|
117 | + 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both |
|
118 | 118 | |
119 | 119 | $r++; |
120 | 120 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \brief Fichier de description et activation du module Mailing |
26 | 26 | */ |
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 | /** |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | $this->module_position = '11'; |
52 | 52 | |
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 EMailings"; |
56 | 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
57 | 57 | $this->version = 'dolibarr'; |
58 | 58 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
59 | - $this->picto='email'; |
|
59 | + $this->picto = 'email'; |
|
60 | 60 | |
61 | 61 | // Data directories to create when module is enabled |
62 | 62 | $this->dirs = array("/mailing/temp"); |
63 | 63 | |
64 | 64 | // Dependencies |
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
70 | 70 | $this->langfiles = array("mails"); |
71 | 71 | |
72 | 72 | // Config pages |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | // Permissions |
82 | 82 | $this->rights = array(); |
83 | 83 | $this->rights_class = 'mailing'; |
84 | - $r=0; |
|
84 | + $r = 0; |
|
85 | 85 | |
86 | 86 | $r++; |
87 | 87 | $this->rights[$r][0] = 221; // id de la permission |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->rights[$r][1] = 'View recipients and info'; |
117 | 117 | $this->rights[$r][2] = 'r'; |
118 | 118 | $this->rights[$r][3] = 0; |
119 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
119 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
120 | 120 | $this->rights[$r][5] = 'recipient'; |
121 | 121 | |
122 | 122 | $r++; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->rights[$r][1] = 'Manually send mailings'; |
125 | 125 | $this->rights[$r][2] = 'w'; |
126 | 126 | $this->rights[$r][3] = 0; |
127 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
127 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
128 | 128 | $this->rights[$r][5] = 'send'; |
129 | 129 | |
130 | 130 | $r++; |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | $this->rights[$r][1] = 'Delete mailings after validation and/or sent'; |
133 | 133 | $this->rights[$r][2] = 'd'; |
134 | 134 | $this->rights[$r][3] = 0; |
135 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
135 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
136 | 136 | $this->rights[$r][5] = 'delete'; |
137 | 137 | |
138 | 138 | // Menus |
139 | 139 | //------- |
140 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
140 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | * @param string $options Options when enabling module ('', 'noboxes') |
150 | 150 | * @return int 1 if OK, 0 if KO |
151 | 151 | */ |
152 | - function init($options='') |
|
152 | + function init($options = '') |
|
153 | 153 | { |
154 | 154 | // Permissions |
155 | 155 | $this->remove($options); |
156 | 156 | |
157 | 157 | $sql = array(); |
158 | 158 | |
159 | - return $this->_init($sql,$options); |
|
159 | + return $this->_init($sql, $options); |
|
160 | 160 | } |
161 | 161 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup deplacement |
24 | 24 | * \brief Fichier de description et activation du module Deplacement et notes de frais |
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 | /** |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | global $conf, $user; |
43 | 43 | |
44 | 44 | $this->db = $db; |
45 | - $this->numero = 75 ; |
|
45 | + $this->numero = 75; |
|
46 | 46 | |
47 | 47 | $this->family = "hr"; |
48 | 48 | $this->module_position = '41'; |
49 | 49 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | - $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee |
|
50 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
51 | + $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee |
|
52 | 52 | |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
54 | 54 | $this->version = 'dolibarr_deprecated'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | // Config pages |
63 | 63 | $this->config_page_url = array(); |
64 | - $this->langfiles = array("companies","trips"); |
|
64 | + $this->langfiles = array("companies", "trips"); |
|
65 | 65 | |
66 | 66 | // Dependancies |
67 | 67 | $this->depends = array(); |
@@ -110,36 +110,36 @@ discard block |
||
110 | 110 | |
111 | 111 | // Menus |
112 | 112 | //------- |
113 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
113 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
114 | 114 | |
115 | 115 | |
116 | 116 | // Exports |
117 | - $r=0; |
|
117 | + $r = 0; |
|
118 | 118 | |
119 | 119 | $r++; |
120 | - $this->export_code[$r]='trips_'.$r; |
|
121 | - $this->export_label[$r]='ListTripsAndExpenses'; |
|
122 | - $this->export_permission[$r]=array(array("deplacement","export")); |
|
123 | - $this->export_fields_array[$r]=array('u.login'=>'Login','u.lastname'=>'Lastname','u.firstname'=>'Firstname','d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.dated'=>"Date",'d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','s.nom'=>'ThirdParty'); |
|
124 | - $this->export_TypeFields_array[$r]=array('u.rowid'=>'List:user:name','u.login'=>'Text','u.lastname'=>'Text','u.firstname'=>'Text','d.type'=>"Text",'d.km'=>"Numeric",'d.dated'=>"Date",'d.note_private'=>'Text','d.note_public'=>'Text','s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text'); |
|
125 | - $this->export_entities_array[$r]=array('u.login'=>'user','u.lastname'=>'user','u.firstname'=>'user','d.rowid'=>"trip",'d.type'=>"trip",'d.km'=>"trip",'d.dated'=>"trip",'d.note_private'=>'trip','d.note_public'=>'trip','s.nom'=>'company'); |
|
126 | - $this->export_dependencies_array[$r]=array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
127 | - |
|
128 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
129 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; |
|
130 | - $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'deplacement as d'; |
|
131 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
|
132 | - if (empty($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'; |
|
133 | - $this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid'; |
|
134 | - $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')'; |
|
135 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; |
|
136 | - |
|
137 | - if (! empty($user)) // Not defined during migration process |
|
120 | + $this->export_code[$r] = 'trips_'.$r; |
|
121 | + $this->export_label[$r] = 'ListTripsAndExpenses'; |
|
122 | + $this->export_permission[$r] = array(array("deplacement", "export")); |
|
123 | + $this->export_fields_array[$r] = array('u.login'=>'Login', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'd.rowid'=>"TripId", 'd.type'=>"Type", 'd.km'=>"FeesKilometersOrAmout", 'd.dated'=>"Date", 'd.note_private'=>'NotePrivate', 'd.note_public'=>'NotePublic', 's.nom'=>'ThirdParty'); |
|
124 | + $this->export_TypeFields_array[$r] = array('u.rowid'=>'List:user:name', 'u.login'=>'Text', 'u.lastname'=>'Text', 'u.firstname'=>'Text', 'd.type'=>"Text", 'd.km'=>"Numeric", 'd.dated'=>"Date", 'd.note_private'=>'Text', 'd.note_public'=>'Text', 's.rowid'=>"List:societe:CompanyName", 's.nom'=>'Text'); |
|
125 | + $this->export_entities_array[$r] = array('u.login'=>'user', 'u.lastname'=>'user', 'u.firstname'=>'user', 'd.rowid'=>"trip", 'd.type'=>"trip", 'd.km'=>"trip", 'd.dated'=>"trip", 'd.note_private'=>'trip', 'd.note_public'=>'trip', 's.nom'=>'company'); |
|
126 | + $this->export_dependencies_array[$r] = array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
127 | + |
|
128 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
129 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; |
|
130 | + $this->export_sql_end[$r] .= ', '.MAIN_DB_PREFIX.'deplacement as d'; |
|
131 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
|
132 | + if (empty($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'; |
|
133 | + $this->export_sql_end[$r] .= ' WHERE d.fk_user = u.rowid'; |
|
134 | + $this->export_sql_end[$r] .= ' AND d.entity IN ('.getEntity('deplacement').')'; |
|
135 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR d.fk_soc IS NULL)'; |
|
136 | + |
|
137 | + if (!empty($user)) // Not defined during migration process |
|
138 | 138 | { |
139 | 139 | $childids = $user->getAllChildIds(); |
140 | - $childids[]=$user->id; |
|
140 | + $childids[] = $user->id; |
|
141 | 141 | |
142 | - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; |
|
142 | + if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql .= ' AND d.fk_user IN ('.join(',', $childids).')'; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | * @param string $options Options when enabling module ('', 'noboxes') |
153 | 153 | * @return int 1 if OK, 0 if KO |
154 | 154 | */ |
155 | - function init($options='') |
|
155 | + function init($options = '') |
|
156 | 156 | { |
157 | 157 | // Permissions |
158 | 158 | $this->remove($options); |
159 | 159 | |
160 | 160 | $sql = array(); |
161 | 161 | |
162 | - return $this->_init($sql,$options); |
|
162 | + return $this->_init($sql, $options); |
|
163 | 163 | } |
164 | 164 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup opensurvey |
24 | 24 | * \brief Description and activation file for module OpenSurvey |
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 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function __construct($db) |
41 | 41 | { |
42 | - global $langs,$conf; |
|
42 | + global $langs, $conf; |
|
43 | 43 | |
44 | 44 | $this->db = $db; |
45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->family = "portal"; |
55 | 55 | $this->module_position = '40'; |
56 | 56 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
57 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
57 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
58 | 58 | // Module description used if translation string 'ModuleXXXDesc' not found (XXX is value MyModule) |
59 | 59 | $this->description = "Module to make online surveys (like Doodle, Studs, Rdvz, ...)"; |
60 | 60 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Name of image file used for this module. |
65 | 65 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
66 | 66 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
67 | - $this->picto='opensurvey.png@opensurvey'; |
|
67 | + $this->picto = 'opensurvey.png@opensurvey'; |
|
68 | 68 | |
69 | 69 | // Data directories to create when module is enabled |
70 | 70 | $this->dirs = array(); |
@@ -72,22 +72,22 @@ discard block |
||
72 | 72 | //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp; |
73 | 73 | |
74 | 74 | // Dependencies |
75 | - $this->hidden = false; // A condition to hide module |
|
76 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
77 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
78 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
79 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
80 | - $this->need_dolibarr_version = array(3,4,0); // Minimum version of Dolibarr required by module |
|
75 | + $this->hidden = false; // A condition to hide module |
|
76 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
77 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
78 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
79 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
80 | + $this->need_dolibarr_version = array(3, 4, 0); // Minimum version of Dolibarr required by module |
|
81 | 81 | |
82 | 82 | // Constants |
83 | - $this->const = array(); // List of parameters |
|
83 | + $this->const = array(); // List of parameters |
|
84 | 84 | |
85 | 85 | // Dictionaries |
86 | - $this->dictionaries=array(); |
|
86 | + $this->dictionaries = array(); |
|
87 | 87 | |
88 | 88 | // Boxes |
89 | - $this->boxes = array(); // List of boxes |
|
90 | - $r=0; |
|
89 | + $this->boxes = array(); // List of boxes |
|
90 | + $r = 0; |
|
91 | 91 | |
92 | 92 | // Add here list of php file(s) stored in includes/boxes that contains class to show a box. |
93 | 93 | // Example: |
@@ -97,32 +97,32 @@ discard block |
||
97 | 97 | //$r++; |
98 | 98 | |
99 | 99 | // Permissions |
100 | - $this->rights = array(); // Permission array used by this module |
|
101 | - $r=0; |
|
100 | + $this->rights = array(); // Permission array used by this module |
|
101 | + $r = 0; |
|
102 | 102 | |
103 | 103 | // Add here list of permission defined by an id, a label, a boolean and two constant strings. |
104 | 104 | // Example: |
105 | - $this->rights[$r][0] = 55001; // Permission id (must not be already used) |
|
106 | - $this->rights[$r][1] = 'Read surveys'; // Permission label |
|
107 | - $this->rights[$r][2] = 'r'; // Permission by default for new user (0/1) |
|
108 | - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
109 | - $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
105 | + $this->rights[$r][0] = 55001; // Permission id (must not be already used) |
|
106 | + $this->rights[$r][1] = 'Read surveys'; // Permission label |
|
107 | + $this->rights[$r][2] = 'r'; // Permission by default for new user (0/1) |
|
108 | + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
109 | + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
110 | 110 | $r++; |
111 | 111 | |
112 | 112 | // Add here list of permission defined by an id, a label, a boolean and two constant strings. |
113 | 113 | // Example: |
114 | - $this->rights[$r][0] = 55002; // Permission id (must not be already used) |
|
115 | - $this->rights[$r][1] = 'Create/modify surveys'; // Permission label |
|
116 | - $this->rights[$r][2] = 'w'; // Permission by default for new user (0/1) |
|
117 | - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
118 | - $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
114 | + $this->rights[$r][0] = 55002; // Permission id (must not be already used) |
|
115 | + $this->rights[$r][1] = 'Create/modify surveys'; // Permission label |
|
116 | + $this->rights[$r][2] = 'w'; // Permission by default for new user (0/1) |
|
117 | + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
118 | + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) |
|
119 | 119 | $r++; |
120 | 120 | |
121 | 121 | |
122 | 122 | // Menus |
123 | 123 | //------- |
124 | - $r=0; |
|
125 | - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
124 | + $r = 0; |
|
125 | + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
126 | 126 | 'type'=>'left', |
127 | 127 | 'titre'=>'Survey', |
128 | 128 | 'mainmenu'=>'tools', |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | 'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey', |
131 | 131 | 'langs'=>'opensurvey', |
132 | 132 | 'position'=>200, |
133 | - 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. |
|
133 | + 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. |
|
134 | 134 | 'perms'=>'$user->rights->opensurvey->read', |
135 | 135 | 'target'=>'', |
136 | 136 | 'user'=>0); |
137 | 137 | $r++; |
138 | 138 | |
139 | - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
139 | + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
140 | 140 | 'type'=>'left', |
141 | 141 | 'titre'=>'NewSurvey', |
142 | 142 | 'mainmenu'=>'tools', |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | 'url'=>'/opensurvey/wizard/index.php', |
145 | 145 | 'langs'=>'opensurvey', |
146 | 146 | 'position'=>210, |
147 | - 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. |
|
147 | + 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. |
|
148 | 148 | 'perms'=>'$user->rights->opensurvey->write', |
149 | 149 | 'target'=>'', |
150 | 150 | 'user'=>0); |
151 | 151 | $r++; |
152 | 152 | |
153 | - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
153 | + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
154 | 154 | 'type'=>'left', |
155 | 155 | 'titre'=>'List', |
156 | 156 | 'mainmenu'=>'tools', |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | 'url'=>'/opensurvey/list.php', |
159 | 159 | 'langs'=>'opensurvey', |
160 | 160 | 'position'=>220, |
161 | - 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. |
|
161 | + 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. |
|
162 | 162 | 'perms'=>'$user->rights->opensurvey->read', |
163 | 163 | 'target'=>'', |
164 | 164 | 'user'=>0); |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | * @param string $options Options when enabling module ('', 'noboxes') |
174 | 174 | * @return int 1 if OK, 0 if KO |
175 | 175 | */ |
176 | - function init($options='') |
|
176 | + function init($options = '') |
|
177 | 177 | { |
178 | 178 | // Permissions |
179 | 179 | $this->remove($options); |
180 | 180 | |
181 | 181 | $sql = array(); |
182 | 182 | |
183 | - return $this->_init($sql,$options); |
|
183 | + return $this->_init($sql, $options); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 |