@@ -48,86 +48,86 @@ discard block |
||
48 | 48 | * @param string $fileprefix Prefix to add into filename of generated PDF |
49 | 49 | * @return int Error code |
50 | 50 | */ |
51 | -function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf') |
|
51 | +function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate = 0, $filesuffix = '', $paymentbankid = '', $thirdpartiesid = '', $fileprefix = 'mergedpdf') |
|
52 | 52 | { |
53 | 53 | $sql = "SELECT DISTINCT f.rowid, f.ref"; |
54 | - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; |
|
55 | - $sqlwhere=''; |
|
56 | - $sqlorder=''; |
|
57 | - if (in_array('all',$filter)) |
|
54 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; |
|
55 | + $sqlwhere = ''; |
|
56 | + $sqlorder = ''; |
|
57 | + if (in_array('all', $filter)) |
|
58 | 58 | { |
59 | 59 | $sqlorder = " ORDER BY f.ref ASC"; |
60 | 60 | } |
61 | - if (in_array('date',$filter)) |
|
61 | + if (in_array('date', $filter)) |
|
62 | 62 | { |
63 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
64 | - else $sqlwhere.=" AND"; |
|
65 | - $sqlwhere.= " f.fk_statut > 0"; |
|
66 | - $sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'"; |
|
67 | - $sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'"; |
|
63 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
64 | + else $sqlwhere .= " AND"; |
|
65 | + $sqlwhere .= " f.fk_statut > 0"; |
|
66 | + $sqlwhere .= " AND f.datef >= '".$db->idate($dateafterdate)."'"; |
|
67 | + $sqlwhere .= " AND f.datef <= '".$db->idate($datebeforedate)."'"; |
|
68 | 68 | $sqlorder = " ORDER BY f.datef ASC"; |
69 | 69 | } |
70 | - if (in_array('nopayment',$filter)) |
|
70 | + if (in_array('nopayment', $filter)) |
|
71 | 71 | { |
72 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; |
|
73 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
74 | - else $sqlwhere.=" AND"; |
|
75 | - $sqlwhere.= " f.fk_statut > 0"; |
|
76 | - $sqlwhere.= " AND pf.fk_paiement IS NULL"; |
|
72 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; |
|
73 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
74 | + else $sqlwhere .= " AND"; |
|
75 | + $sqlwhere .= " f.fk_statut > 0"; |
|
76 | + $sqlwhere .= " AND pf.fk_paiement IS NULL"; |
|
77 | 77 | } |
78 | - if (in_array('payments',$filter) || in_array('bank',$filter)) |
|
78 | + if (in_array('payments', $filter) || in_array('bank', $filter)) |
|
79 | 79 | { |
80 | - $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; |
|
81 | - if (in_array('bank',$filter)) $sql.= ", ".MAIN_DB_PREFIX."bank as b"; |
|
82 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
83 | - else $sqlwhere.=" AND"; |
|
84 | - $sqlwhere.= " f.fk_statut > 0"; |
|
85 | - $sqlwhere.= " AND f.rowid = pf.fk_facture"; |
|
86 | - $sqlwhere.= " AND pf.fk_paiement = p.rowid"; |
|
87 | - if (in_array('payments',$filter)) |
|
80 | + $sql .= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; |
|
81 | + if (in_array('bank', $filter)) $sql .= ", ".MAIN_DB_PREFIX."bank as b"; |
|
82 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
83 | + else $sqlwhere .= " AND"; |
|
84 | + $sqlwhere .= " f.fk_statut > 0"; |
|
85 | + $sqlwhere .= " AND f.rowid = pf.fk_facture"; |
|
86 | + $sqlwhere .= " AND pf.fk_paiement = p.rowid"; |
|
87 | + if (in_array('payments', $filter)) |
|
88 | 88 | { |
89 | - $sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'"; |
|
90 | - $sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'"; |
|
89 | + $sqlwhere .= " AND p.datep >= '".$db->idate($paymentdateafter)."'"; |
|
90 | + $sqlwhere .= " AND p.datep <= '".$db->idate($paymentdatebefore)."'"; |
|
91 | 91 | } |
92 | - if (in_array('bank',$filter)) |
|
92 | + if (in_array('bank', $filter)) |
|
93 | 93 | { |
94 | - $sqlwhere.= " AND p.fk_bank = b.rowid"; |
|
95 | - $sqlwhere.= " AND b.fk_account = ".$paymentbankid; |
|
94 | + $sqlwhere .= " AND p.fk_bank = b.rowid"; |
|
95 | + $sqlwhere .= " AND b.fk_account = ".$paymentbankid; |
|
96 | 96 | } |
97 | 97 | $sqlorder = " ORDER BY p.datep ASC"; |
98 | 98 | } |
99 | - if (in_array('nodeposit',$filter)) |
|
99 | + if (in_array('nodeposit', $filter)) |
|
100 | 100 | { |
101 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
102 | - else $sqlwhere.=" AND"; |
|
103 | - $sqlwhere.=' type <> 3'; |
|
101 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
102 | + else $sqlwhere .= " AND"; |
|
103 | + $sqlwhere .= ' type <> 3'; |
|
104 | 104 | } |
105 | - if (in_array('noreplacement',$filter)) |
|
105 | + if (in_array('noreplacement', $filter)) |
|
106 | 106 | { |
107 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
108 | - else $sqlwhere.=" AND"; |
|
109 | - $sqlwhere.=' type <> 1'; |
|
107 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
108 | + else $sqlwhere .= " AND"; |
|
109 | + $sqlwhere .= ' type <> 1'; |
|
110 | 110 | } |
111 | - if (in_array('nocreditnote',$filter)) |
|
111 | + if (in_array('nocreditnote', $filter)) |
|
112 | 112 | { |
113 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
114 | - else $sqlwhere.=" AND"; |
|
115 | - $sqlwhere.=' type <> 2'; |
|
113 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
114 | + else $sqlwhere .= " AND"; |
|
115 | + $sqlwhere .= ' type <> 2'; |
|
116 | 116 | } |
117 | - if (in_array('excludethirdparties',$filter) && is_array($thirdpartiesid)) |
|
117 | + if (in_array('excludethirdparties', $filter) && is_array($thirdpartiesid)) |
|
118 | 118 | { |
119 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
120 | - else $sqlwhere.=" AND"; |
|
121 | - $sqlwhere.=' f.fk_soc NOT IN ('.join(',',$thirdpartiesid).')'; |
|
119 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
120 | + else $sqlwhere .= " AND"; |
|
121 | + $sqlwhere .= ' f.fk_soc NOT IN ('.join(',', $thirdpartiesid).')'; |
|
122 | 122 | } |
123 | - if (in_array('onlythirdparties',$filter) && is_array($thirdpartiesid)) |
|
123 | + if (in_array('onlythirdparties', $filter) && is_array($thirdpartiesid)) |
|
124 | 124 | { |
125 | - if (empty($sqlwhere)) $sqlwhere=' WHERE '; |
|
126 | - else $sqlwhere.=" AND"; |
|
127 | - $sqlwhere.=' f.fk_soc IN ('.join(',',$thirdpartiesid).')'; |
|
125 | + if (empty($sqlwhere)) $sqlwhere = ' WHERE '; |
|
126 | + else $sqlwhere .= " AND"; |
|
127 | + $sqlwhere .= ' f.fk_soc IN ('.join(',', $thirdpartiesid).')'; |
|
128 | 128 | } |
129 | - if ($sqlwhere) $sql.=$sqlwhere; |
|
130 | - if ($sqlorder) $sql.=$sqlorder; |
|
129 | + if ($sqlwhere) $sql .= $sqlwhere; |
|
130 | + if ($sqlorder) $sql .= $sqlorder; |
|
131 | 131 | |
132 | 132 | //print $sql; exit; |
133 | 133 | dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | |
140 | 140 | $error = 0; |
141 | 141 | $result = 0; |
142 | - $files = array() ; // liste les fichiers |
|
142 | + $files = array(); // liste les fichiers |
|
143 | 143 | |
144 | 144 | dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG); |
145 | - if ( $resql=$db->query($sql) ) |
|
145 | + if ($resql = $db->query($sql)) |
|
146 | 146 | { |
147 | 147 | $num = $db->num_rows($resql); |
148 | 148 | $cpt = 0; |
@@ -160,23 +160,23 @@ discard block |
||
160 | 160 | $obj = $db->fetch_object($resql); |
161 | 161 | |
162 | 162 | $fac = new Facture($db); |
163 | - $result=$fac->fetch($obj->rowid); |
|
163 | + $result = $fac->fetch($obj->rowid); |
|
164 | 164 | if ($result > 0) |
165 | 165 | { |
166 | 166 | $outputlangs = $langs; |
167 | - if (! empty($newlangid)) |
|
167 | + if (!empty($newlangid)) |
|
168 | 168 | { |
169 | 169 | if ($outputlangs->defaultlang != $newlangid) |
170 | 170 | { |
171 | - $outputlangs = new Translate("",$conf); |
|
171 | + $outputlangs = new Translate("", $conf); |
|
172 | 172 | $outputlangs->setDefaultLang($newlangid); |
173 | 173 | } |
174 | 174 | } |
175 | - $filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf'; |
|
176 | - if ($regenerate || ! dol_is_file($filename)) |
|
175 | + $filename = $conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf'; |
|
176 | + if ($regenerate || !dol_is_file($filename)) |
|
177 | 177 | { |
178 | 178 | if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n"; |
179 | - $result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs); |
|
179 | + $result = $fac->generateDocument($regenerate ? $regenerate : $fac->modelpdf, $outputlangs); |
|
180 | 180 | } |
181 | 181 | else { |
182 | 182 | if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n"; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | if ($result <= 0) |
190 | 190 | { |
191 | 191 | $error++; |
192 | - if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n"; |
|
193 | - else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR); |
|
192 | + if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref ? $fac->ref : ' id '.$obj->rowid)."\n"; |
|
193 | + else dol_syslog("Failed to build PDF for invoice ".($fac->ref ? $fac->ref : ' id '.$obj->rowid), LOG_ERR); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | $cpt++; |
@@ -198,20 +198,20 @@ discard block |
||
198 | 198 | |
199 | 199 | |
200 | 200 | // Define format of output PDF |
201 | - $formatarray=pdf_getFormat($langs); |
|
201 | + $formatarray = pdf_getFormat($langs); |
|
202 | 202 | $page_largeur = $formatarray['width']; |
203 | 203 | $page_hauteur = $formatarray['height']; |
204 | - $format = array($page_largeur,$page_hauteur); |
|
204 | + $format = array($page_largeur, $page_hauteur); |
|
205 | 205 | |
206 | - if ($usestdout) print "Using output PDF format ".join('x',$format)."\n"; |
|
207 | - else dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR); |
|
206 | + if ($usestdout) print "Using output PDF format ".join('x', $format)."\n"; |
|
207 | + else dol_syslog("Using output PDF format ".join('x', $format), LOG_ERR); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | // Now, build a merged files with all files in $files array |
211 | 211 | //--------------------------------------------------------- |
212 | 212 | |
213 | 213 | // Create empty PDF |
214 | - $pdf=pdf_getInstance($format); |
|
214 | + $pdf = pdf_getInstance($format); |
|
215 | 215 | if (class_exists('TCPDF')) |
216 | 216 | { |
217 | 217 | $pdf->setPrintHeader(false); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | //$pdf->SetCompression(false); |
224 | 224 | |
225 | 225 | // Add all others |
226 | - foreach($files as $file) |
|
226 | + foreach ($files as $file) |
|
227 | 227 | { |
228 | 228 | if ($usestdout) print "Merge PDF file for invoice ".$file."\n"; |
229 | 229 | else dol_syslog("Merge PDF file for invoice ".$file); |
@@ -243,21 +243,21 @@ discard block |
||
243 | 243 | dol_mkdir($diroutputpdf); |
244 | 244 | |
245 | 245 | // Save merged file |
246 | - $filename=$fileprefix; |
|
247 | - if (empty($filename)) $filename='mergedpdf'; |
|
248 | - if (! empty($filesuffix)) $filename.='_'.$filesuffix; |
|
249 | - $file=$diroutputpdf.'/'.$filename.'.pdf'; |
|
246 | + $filename = $fileprefix; |
|
247 | + if (empty($filename)) $filename = 'mergedpdf'; |
|
248 | + if (!empty($filesuffix)) $filename .= '_'.$filesuffix; |
|
249 | + $file = $diroutputpdf.'/'.$filename.'.pdf'; |
|
250 | 250 | |
251 | - if (! $error && $pagecount) |
|
251 | + if (!$error && $pagecount) |
|
252 | 252 | { |
253 | - $pdf->Output($file,'F'); |
|
254 | - if (! empty($conf->global->MAIN_UMASK)) |
|
253 | + $pdf->Output($file, 'F'); |
|
254 | + if (!empty($conf->global->MAIN_UMASK)) |
|
255 | 255 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
256 | 256 | } |
257 | 257 | |
258 | 258 | if ($usestdout) |
259 | 259 | { |
260 | - if (! $error) print "Merged PDF has been built in ".$file."\n"; |
|
260 | + if (!$error) print "Merged PDF has been built in ".$file."\n"; |
|
261 | 261 | else print "Can't build PDF ".$file."\n"; |
262 | 262 | } |
263 | 263 |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | // Entries must be declared in modules descriptor with line |
64 | 64 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
65 | 65 | // $this->tabs = array('entity:-tabname); to remove a tab |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement'); |
|
67 | 67 | |
68 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement','remove'); |
|
68 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement', 'remove'); |
|
69 | 69 | |
70 | 70 | return $head; |
71 | 71 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | function prelevement_check_config() |
79 | 79 | { |
80 | 80 | global $conf; |
81 | - if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1; |
|
82 | - if(empty($conf->global->PRELEVEMENT_ICS)) return -1; |
|
83 | - if(empty($conf->global->PRELEVEMENT_USER)) return -1; |
|
81 | + if (empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1; |
|
82 | + if (empty($conf->global->PRELEVEMENT_ICS)) return -1; |
|
83 | + if (empty($conf->global->PRELEVEMENT_USER)) return -1; |
|
84 | 84 | return 0; |
85 | 85 | } |
86 | 86 |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | /* ******************************************************************** */ |
28 | 28 | /* COLORS */ |
29 | 29 | /* ******************************************************************** */ |
30 | -$bar_color=array(0,0,0); |
|
31 | -$bg_color=array(255,255,255); |
|
32 | -$text_color=array(0,0,0); |
|
30 | +$bar_color = array(0, 0, 0); |
|
31 | +$bg_color = array(255, 255, 255); |
|
32 | +$text_color = array(0, 0, 0); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | /* ******************************************************************** */ |
36 | 36 | /* FONT FILE */ |
37 | 37 | /* ******************************************************************** */ |
38 | -if (defined('DOL_DEFAULT_TTF_BOLD')) $font_loc=constant('DOL_DEFAULT_TTF_BOLD'); |
|
38 | +if (defined('DOL_DEFAULT_TTF_BOLD')) $font_loc = constant('DOL_DEFAULT_TTF_BOLD'); |
|
39 | 39 | // Automatic-Detection of Font if running Windows |
40 | 40 | // @CHANGE LDR |
41 | -if (isset($_SERVER['WINDIR']) && @file_exists($_SERVER['WINDIR'])) $font_loc=$_SERVER['WINDIR'].'\Fonts\arialbd.ttf'; |
|
41 | +if (isset($_SERVER['WINDIR']) && @file_exists($_SERVER['WINDIR'])) $font_loc = $_SERVER['WINDIR'].'\Fonts\arialbd.ttf'; |
|
42 | 42 | if (empty($font_loc)) die('DOL_DEFAULT_TTF_BOLD must de defined with full path to a TTF font.'); |
43 | 43 | |
44 | 44 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * genbarcode is needed to render encodings other than EAN-12/EAN-13/ISBN |
51 | 51 | */ |
52 | 52 | |
53 | -if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND'); |
|
53 | +if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND'); |
|
54 | 54 | else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; |
55 | 55 | |
56 | 56 | |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | * @param string $mode 'png' or 'jpg' ... |
66 | 66 | * @return array|string $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) or string with error message |
67 | 67 | */ |
68 | -function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png") |
|
68 | +function barcode_print($code, $encoding = "ANY", $scale = 2, $mode = "png") |
|
69 | 69 | { |
70 | 70 | dol_syslog("barcode.lib.php::barcode_print $code $encoding $scale $mode"); |
71 | 71 | |
72 | - $bars=barcode_encode($code,$encoding); |
|
73 | - if (! $bars || ! empty($bars['error'])) |
|
72 | + $bars = barcode_encode($code, $encoding); |
|
73 | + if (!$bars || !empty($bars['error'])) |
|
74 | 74 | { |
75 | 75 | // Return error message instead of array |
76 | - if (empty($bars['error'])) $error='Bad Value '.$code.' for encoding '.$encoding; |
|
77 | - else $error=$bars['error']; |
|
76 | + if (empty($bars['error'])) $error = 'Bad Value '.$code.' for encoding '.$encoding; |
|
77 | + else $error = $bars['error']; |
|
78 | 78 | dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR); |
79 | 79 | return $error; |
80 | 80 | } |
81 | - if (! $mode) $mode="png"; |
|
81 | + if (!$mode) $mode = "png"; |
|
82 | 82 | //if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']); |
83 | 83 | //elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0); |
84 | 84 | //else |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param string $encoding Encoding |
109 | 109 | * @return array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) |
110 | 110 | */ |
111 | -function barcode_encode($code,$encoding) |
|
111 | +function barcode_encode($code, $encoding) |
|
112 | 112 | { |
113 | 113 | global $genbarcode_loc; |
114 | 114 | |
@@ -116,23 +116,23 @@ discard block |
||
116 | 116 | (preg_match("/^ean$/i", $encoding)) |
117 | 117 | |
118 | 118 | || (($encoding) && (preg_match("/^isbn$/i", $encoding)) |
119 | - && (( strlen($code)==9 || strlen($code)==10) || |
|
120 | - (((preg_match("/^978/", $code) && strlen($code)==12) || |
|
121 | - (strlen($code)==13))))) |
|
119 | + && ((strlen($code) == 9 || strlen($code) == 10) || |
|
120 | + (((preg_match("/^978/", $code) && strlen($code) == 12) || |
|
121 | + (strlen($code) == 13))))) |
|
122 | 122 | |
123 | - || (( !isset($encoding) || !$encoding || (preg_match("/^ANY$/i", $encoding) )) |
|
123 | + || ((!isset($encoding) || !$encoding || (preg_match("/^ANY$/i", $encoding))) |
|
124 | 124 | && (preg_match("/^[0-9]{12,13}$/", $code))) |
125 | 125 | ) |
126 | 126 | { |
127 | 127 | /* use built-in EAN-Encoder */ |
128 | 128 | dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean"); |
129 | - $bars=barcode_encode_ean($code, $encoding); |
|
129 | + $bars = barcode_encode_ean($code, $encoding); |
|
130 | 130 | } |
131 | 131 | else if (file_exists($genbarcode_loc)) // For example C39 |
132 | 132 | { |
133 | 133 | /* use genbarcode */ |
134 | 134 | dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding); |
135 | - $bars=barcode_encode_genbarcode($code, $encoding); |
|
135 | + $bars = barcode_encode_genbarcode($code, $encoding); |
|
136 | 136 | } |
137 | 137 | else |
138 | 138 | { |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | */ |
161 | 161 | function barcode_gen_ean_sum($ean) |
162 | 162 | { |
163 | - $even=true; $esum=0; $osum=0; |
|
164 | - $ln=strlen($ean)-1; |
|
165 | - for ($i=$ln; $i>=0; $i--) |
|
163 | + $even = true; $esum = 0; $osum = 0; |
|
164 | + $ln = strlen($ean) - 1; |
|
165 | + for ($i = $ln; $i >= 0; $i--) |
|
166 | 166 | { |
167 | - if ($even) $esum+=$ean[$i]; else $osum+=$ean[$i]; |
|
168 | - $even=!$even; |
|
167 | + if ($even) $esum += $ean[$i]; else $osum += $ean[$i]; |
|
168 | + $even = !$even; |
|
169 | 169 | } |
170 | - return (10-((3*$esum+$osum)%10))%10; |
|
170 | + return (10 - ((3 * $esum + $osum) % 10)) % 10; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -179,48 +179,48 @@ discard block |
||
179 | 179 | */ |
180 | 180 | function barcode_encode_ean($ean, $encoding = "EAN-13") |
181 | 181 | { |
182 | - $digits=array(3211,2221,2122,1411,1132,1231,1114,1312,1213,3112); |
|
183 | - $mirror=array("000000","001011","001101","001110","010011","011001","011100","010101","010110","011010"); |
|
184 | - $guards=array("9a1a","1a1a1","a1a"); |
|
182 | + $digits = array(3211, 2221, 2122, 1411, 1132, 1231, 1114, 1312, 1213, 3112); |
|
183 | + $mirror = array("000000", "001011", "001101", "001110", "010011", "011001", "011100", "010101", "010110", "011010"); |
|
184 | + $guards = array("9a1a", "1a1a1", "a1a"); |
|
185 | 185 | |
186 | - $ean=trim($ean); |
|
187 | - if (preg_match("/[^0-9]/i",$ean)) |
|
186 | + $ean = trim($ean); |
|
187 | + if (preg_match("/[^0-9]/i", $ean)) |
|
188 | 188 | { |
189 | 189 | return array("error"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (not a numeric)", "text"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (not a numeric)"); |
190 | 190 | } |
191 | - $encoding=strtoupper($encoding); |
|
192 | - if ($encoding=="ISBN") |
|
191 | + $encoding = strtoupper($encoding); |
|
192 | + if ($encoding == "ISBN") |
|
193 | 193 | { |
194 | - if (!preg_match("/^978/", $ean)) $ean="978".$ean; |
|
194 | + if (!preg_match("/^978/", $ean)) $ean = "978".$ean; |
|
195 | 195 | } |
196 | - if (preg_match("/^978/", $ean)) $encoding="ISBN"; |
|
197 | - if (strlen($ean)<12 || strlen($ean)>13) |
|
196 | + if (preg_match("/^978/", $ean)) $encoding = "ISBN"; |
|
197 | + if (strlen($ean) < 12 || strlen($ean) > 13) |
|
198 | 198 | { |
199 | 199 | return array("error"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (must have 12/13 numbers)", "text"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (must have 12/13 numbers)"); |
200 | 200 | } |
201 | 201 | |
202 | - $ean=substr($ean,0,12); |
|
203 | - $eansum=barcode_gen_ean_sum($ean); |
|
204 | - $ean.=$eansum; |
|
205 | - $line=$guards[0]; |
|
206 | - for ($i=1;$i<13;$i++) |
|
202 | + $ean = substr($ean, 0, 12); |
|
203 | + $eansum = barcode_gen_ean_sum($ean); |
|
204 | + $ean .= $eansum; |
|
205 | + $line = $guards[0]; |
|
206 | + for ($i = 1; $i < 13; $i++) |
|
207 | 207 | { |
208 | - $str=$digits[$ean[$i]]; |
|
209 | - if ($i<7 && $mirror[$ean[0]][$i-1]==1) $line.=strrev($str); else $line.=$str; |
|
210 | - if ($i==6) $line.=$guards[1]; |
|
208 | + $str = $digits[$ean[$i]]; |
|
209 | + if ($i < 7 && $mirror[$ean[0]][$i - 1] == 1) $line .= strrev($str); else $line .= $str; |
|
210 | + if ($i == 6) $line .= $guards[1]; |
|
211 | 211 | } |
212 | - $line.=$guards[2]; |
|
212 | + $line .= $guards[2]; |
|
213 | 213 | |
214 | 214 | /* create text */ |
215 | - $pos=0; |
|
216 | - $text=""; |
|
217 | - for ($a=0;$a<13;$a++) |
|
215 | + $pos = 0; |
|
216 | + $text = ""; |
|
217 | + for ($a = 0; $a < 13; $a++) |
|
218 | 218 | { |
219 | - if ($a>0) $text.=" "; |
|
220 | - $text.="$pos:12:{$ean[$a]}"; |
|
221 | - if ($a==0) $pos+=12; |
|
222 | - else if ($a==6) $pos+=12; |
|
223 | - else $pos+=7; |
|
219 | + if ($a > 0) $text .= " "; |
|
220 | + $text .= "$pos:12:{$ean[$a]}"; |
|
221 | + if ($a == 0) $pos += 12; |
|
222 | + else if ($a == 6) $pos += 12; |
|
223 | + else $pos += 7; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return array( |
@@ -238,30 +238,30 @@ discard block |
||
238 | 238 | * @param string $encoding Encoding |
239 | 239 | * @return array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) |
240 | 240 | */ |
241 | -function barcode_encode_genbarcode($code,$encoding) |
|
241 | +function barcode_encode_genbarcode($code, $encoding) |
|
242 | 242 | { |
243 | 243 | global $genbarcode_loc; |
244 | 244 | |
245 | 245 | // Clean parameters |
246 | - if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12); |
|
247 | - if (!$encoding) $encoding="ANY"; |
|
248 | - $encoding=preg_replace("/[\\\|]/", "_", $encoding); |
|
249 | - $code=preg_replace("/[\\\|]/", "_", $code); |
|
246 | + if (preg_match("/^ean$/i", $encoding) && strlen($code) == 13) $code = substr($code, 0, 12); |
|
247 | + if (!$encoding) $encoding = "ANY"; |
|
248 | + $encoding = preg_replace("/[\\\|]/", "_", $encoding); |
|
249 | + $code = preg_replace("/[\\\|]/", "_", $code); |
|
250 | 250 | |
251 | - $command=escapeshellarg($genbarcode_loc); |
|
251 | + $command = escapeshellarg($genbarcode_loc); |
|
252 | 252 | //$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\""; |
253 | - $paramclear=" ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding)); |
|
253 | + $paramclear = " ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding)); |
|
254 | 254 | |
255 | - $fullcommandclear=$command." ".$paramclear." 2>&1"; |
|
255 | + $fullcommandclear = $command." ".$paramclear." 2>&1"; |
|
256 | 256 | //print $fullcommandclear."<br>\n";exit; |
257 | 257 | |
258 | 258 | dol_syslog("Run command ".$fullcommandclear); |
259 | - $fp=popen($fullcommandclear, "r"); |
|
259 | + $fp = popen($fullcommandclear, "r"); |
|
260 | 260 | if ($fp) |
261 | 261 | { |
262 | - $bars=fgets($fp, 1024); |
|
263 | - $text=fgets($fp, 1024); |
|
264 | - $encoding=fgets($fp, 1024); |
|
262 | + $bars = fgets($fp, 1024); |
|
263 | + $text = fgets($fp, 1024); |
|
264 | + $encoding = fgets($fp, 1024); |
|
265 | 265 | pclose($fp); |
266 | 266 | } |
267 | 267 | else |
@@ -270,16 +270,16 @@ discard block |
||
270 | 270 | return false; |
271 | 271 | } |
272 | 272 | //var_dump($bars); |
273 | - $ret=array( |
|
273 | + $ret = array( |
|
274 | 274 | "bars" => trim($bars), |
275 | 275 | "text" => trim($text), |
276 | 276 | "encoding" => trim($encoding), |
277 | 277 | "error" => "" |
278 | 278 | ); |
279 | 279 | //var_dump($ret); |
280 | - if (preg_match('/permission denied/i',$ret['bars'])) |
|
280 | + if (preg_match('/permission denied/i', $ret['bars'])) |
|
281 | 281 | { |
282 | - $ret['error']=$ret['bars']; $ret['bars']=''; |
|
282 | + $ret['error'] = $ret['bars']; $ret['bars'] = ''; |
|
283 | 283 | return $ret; |
284 | 284 | } |
285 | 285 | if (!$ret['bars']) return false; |
@@ -310,101 +310,101 @@ discard block |
||
310 | 310 | //var_dump($font_loc); |
311 | 311 | |
312 | 312 | /* set defaults */ |
313 | - if ($scale<1) $scale=2; |
|
314 | - $total_y=(int) $total_y; |
|
315 | - if ($total_y<1) $total_y=(int) $scale * 60; |
|
313 | + if ($scale < 1) $scale = 2; |
|
314 | + $total_y = (int) $total_y; |
|
315 | + if ($total_y < 1) $total_y = (int) $scale * 60; |
|
316 | 316 | if (!$space) |
317 | - $space=array('top'=>2*$scale,'bottom'=>2*$scale,'left'=>2*$scale,'right'=>2*$scale); |
|
317 | + $space = array('top'=>2 * $scale, 'bottom'=>2 * $scale, 'left'=>2 * $scale, 'right'=>2 * $scale); |
|
318 | 318 | |
319 | 319 | /* count total width */ |
320 | - $xpos=0; |
|
321 | - $width=true; |
|
322 | - $ln=strlen($bars); |
|
323 | - for ($i=0; $i<$ln; $i++) |
|
320 | + $xpos = 0; |
|
321 | + $width = true; |
|
322 | + $ln = strlen($bars); |
|
323 | + for ($i = 0; $i < $ln; $i++) |
|
324 | 324 | { |
325 | - $val=strtolower($bars[$i]); |
|
325 | + $val = strtolower($bars[$i]); |
|
326 | 326 | if ($width) |
327 | 327 | { |
328 | - $xpos+=$val*$scale; |
|
329 | - $width=false; |
|
328 | + $xpos += $val * $scale; |
|
329 | + $width = false; |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | if (preg_match("/[a-z]/", $val)) |
333 | 333 | { |
334 | 334 | /* tall bar */ |
335 | - $val=ord($val)-ord('a')+1; |
|
335 | + $val = ord($val) - ord('a') + 1; |
|
336 | 336 | } |
337 | - $xpos+=$val*$scale; |
|
338 | - $width=true; |
|
337 | + $xpos += $val * $scale; |
|
338 | + $width = true; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /* allocate the image */ |
342 | - $total_x=( $xpos )+$space['right']+$space['right']; |
|
343 | - $xpos=$space['left']; |
|
344 | - if (! function_exists("imagecreate")) |
|
342 | + $total_x = ($xpos) + $space['right'] + $space['right']; |
|
343 | + $xpos = $space['left']; |
|
344 | + if (!function_exists("imagecreate")) |
|
345 | 345 | { |
346 | 346 | print "You don't have the gd2 extension enabled<br>\n"; |
347 | 347 | return ""; |
348 | 348 | } |
349 | - $im=imagecreate($total_x, $total_y); |
|
349 | + $im = imagecreate($total_x, $total_y); |
|
350 | 350 | /* create two images */ |
351 | - $col_bg=ImageColorAllocate($im,$bg_color[0],$bg_color[1],$bg_color[2]); |
|
352 | - $col_bar=ImageColorAllocate($im,$bar_color[0],$bar_color[1],$bar_color[2]); |
|
353 | - $col_text=ImageColorAllocate($im,$text_color[0],$text_color[1],$text_color[2]); |
|
354 | - $height=round($total_y-($scale*10)); |
|
355 | - $height2=round($total_y-$space['bottom']); |
|
351 | + $col_bg = ImageColorAllocate($im, $bg_color[0], $bg_color[1], $bg_color[2]); |
|
352 | + $col_bar = ImageColorAllocate($im, $bar_color[0], $bar_color[1], $bar_color[2]); |
|
353 | + $col_text = ImageColorAllocate($im, $text_color[0], $text_color[1], $text_color[2]); |
|
354 | + $height = round($total_y - ($scale * 10)); |
|
355 | + $height2 = round($total_y - $space['bottom']); |
|
356 | 356 | |
357 | 357 | /* paint the bars */ |
358 | - $width=true; |
|
359 | - $ln=strlen($bars); |
|
360 | - for ($i=0; $i<$ln; $i++) |
|
358 | + $width = true; |
|
359 | + $ln = strlen($bars); |
|
360 | + for ($i = 0; $i < $ln; $i++) |
|
361 | 361 | { |
362 | - $val=strtolower($bars[$i]); |
|
362 | + $val = strtolower($bars[$i]); |
|
363 | 363 | if ($width) |
364 | 364 | { |
365 | - $xpos+=$val*$scale; |
|
366 | - $width=false; |
|
365 | + $xpos += $val * $scale; |
|
366 | + $width = false; |
|
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | if (preg_match("/[a-z]/", $val)) |
370 | 370 | { |
371 | 371 | /* tall bar */ |
372 | - $val=ord($val)-ord('a')+1; |
|
373 | - $h=$height2; |
|
374 | - } else $h=$height; |
|
375 | - imagefilledrectangle($im, $xpos, $space['top'], $xpos+($val*$scale)-1, $h, $col_bar); |
|
376 | - $xpos+=$val*$scale; |
|
377 | - $width=true; |
|
372 | + $val = ord($val) - ord('a') + 1; |
|
373 | + $h = $height2; |
|
374 | + } else $h = $height; |
|
375 | + imagefilledrectangle($im, $xpos, $space['top'], $xpos + ($val * $scale) - 1, $h, $col_bar); |
|
376 | + $xpos += $val * $scale; |
|
377 | + $width = true; |
|
378 | 378 | } |
379 | 379 | |
380 | - $chars=explode(" ", $text); |
|
380 | + $chars = explode(" ", $text); |
|
381 | 381 | reset($chars); |
382 | - while (list($n, $v)=each($chars)) |
|
382 | + while (list($n, $v) = each($chars)) |
|
383 | 383 | { |
384 | 384 | if (trim($v)) |
385 | 385 | { |
386 | - $inf=explode(":", $v); |
|
387 | - $fontsize=$scale*($inf[1]/1.8); |
|
388 | - $fontheight=$total_y-($fontsize/2.7)+2; |
|
389 | - imagettftext($im, $fontsize, 0, $space['left']+($scale*$inf[0])+2, $fontheight, $col_text, $font_loc, $inf[2]); |
|
386 | + $inf = explode(":", $v); |
|
387 | + $fontsize = $scale * ($inf[1] / 1.8); |
|
388 | + $fontheight = $total_y - ($fontsize / 2.7) + 2; |
|
389 | + imagettftext($im, $fontsize, 0, $space['left'] + ($scale * $inf[0]) + 2, $fontheight, $col_text, $font_loc, $inf[2]); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | 393 | /* output the image */ |
394 | - $mode=strtolower($mode); |
|
395 | - if ($mode=='jpg' || $mode=='jpeg') |
|
394 | + $mode = strtolower($mode); |
|
395 | + if ($mode == 'jpg' || $mode == 'jpeg') |
|
396 | 396 | { |
397 | 397 | header("Content-Type: image/jpeg; name=\"barcode.jpg\""); |
398 | 398 | imagejpeg($im); |
399 | 399 | } |
400 | - else if ($mode=='gif') |
|
400 | + else if ($mode == 'gif') |
|
401 | 401 | { |
402 | 402 | header("Content-Type: image/gif; name=\"barcode.gif\""); |
403 | 403 | imagegif($im); |
404 | 404 | } |
405 | - else if (! empty($filebarcode)) // To wxrite into afile onto disk |
|
405 | + else if (!empty($filebarcode)) // To wxrite into afile onto disk |
|
406 | 406 | { |
407 | - imagepng($im,$filebarcode); |
|
407 | + imagepng($im, $filebarcode); |
|
408 | 408 | } |
409 | 409 | else |
410 | 410 | { |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | global $langs, $conf; |
35 | 35 | |
36 | 36 | $h = 0; |
37 | - $head = array (); |
|
37 | + $head = array(); |
|
38 | 38 | |
39 | - $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id=' . $object->id; |
|
39 | + $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$object->id; |
|
40 | 40 | $head[$h][1] = $langs->trans("Card"); |
41 | 41 | $head[$h][2] = 'card'; |
42 | - $h ++; |
|
42 | + $h++; |
|
43 | 43 | |
44 | 44 | // Show more tabs from modules |
45 | 45 | // Entries must be declared in modules descriptor with line |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function clean_account($account) |
62 | 62 | { |
63 | - $account = rtrim($account,"0"); |
|
63 | + $account = rtrim($account, "0"); |
|
64 | 64 | |
65 | 65 | return $account; |
66 | 66 | } |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | |
78 | 78 | if ($account < 0 || empty($account)) return ''; |
79 | 79 | |
80 | - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; |
|
80 | + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; |
|
81 | 81 | |
82 | 82 | $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT; |
83 | - if (! empty($g)) { |
|
83 | + if (!empty($g)) { |
|
84 | 84 | // Clean parameters |
85 | 85 | $i = strlen($account); |
86 | 86 | |
87 | 87 | if ($i >= 1) { |
88 | - while ( $i < $g ) { |
|
88 | + while ($i < $g) { |
|
89 | 89 | $account .= '0'; |
90 | 90 | |
91 | - $i ++; |
|
91 | + $i++; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $account; |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | |
113 | 113 | if ($accounta < 0 || empty($accounta)) return ''; |
114 | 114 | |
115 | - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; |
|
115 | + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; |
|
116 | 116 | |
117 | 117 | $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; |
118 | - if (! empty($a)) { |
|
118 | + if (!empty($a)) { |
|
119 | 119 | // Clean parameters |
120 | 120 | $i = strlen($accounta); |
121 | 121 | |
122 | 122 | if ($i >= 1) { |
123 | - while ( $i < $a ) { |
|
123 | + while ($i < $a) { |
|
124 | 124 | $accounta .= '0'; |
125 | 125 | |
126 | - $i ++; |
|
126 | + $i++; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return $accounta; |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | * @param string $varlink Add a variable into the address of the page |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function journalHead($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='') |
|
155 | +function journalHead($nom, $variante, $period, $periodlink, $description, $builddate, $exportlink = '', $moreparam = array(), $calcmode = '', $varlink = '') |
|
156 | 156 | { |
157 | 157 | global $langs; |
158 | 158 | |
159 | - if (empty($hselected)) $hselected='report'; |
|
159 | + if (empty($hselected)) $hselected = 'report'; |
|
160 | 160 | |
161 | 161 | print "\n\n<!-- debut cartouche journal -->\n"; |
162 | 162 | |
163 | - if(! empty($varlink)) $varlink = '?'.$varlink; |
|
163 | + if (!empty($varlink)) $varlink = '?'.$varlink; |
|
164 | 164 | |
165 | - $h=0; |
|
165 | + $h = 0; |
|
166 | 166 | $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; |
167 | 167 | $head[$h][1] = $langs->trans("Journalization"); |
168 | 168 | $head[$h][2] = 'journal'; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | dol_fiche_head($head, 'journal'); |
173 | 173 | |
174 | - foreach($moreparam as $key => $value) |
|
174 | + foreach ($moreparam as $key => $value) |
|
175 | 175 | { |
176 | 176 | print '<input type="hidden" name="'.$key.'" value="'.$value.'">'; |
177 | 177 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // Ligne de titre |
181 | 181 | print '<tr>'; |
182 | 182 | print '<td width="110">'.$langs->trans("Name").'</td>'; |
183 | - if (! $variantexxx) print '<td colspan="3">'; |
|
183 | + if (!$variantexxx) print '<td colspan="3">'; |
|
184 | 184 | else print '<td>'; |
185 | 185 | print $nom; |
186 | 186 | if ($variantexxx) print '</td><td colspan="2">'.$variantexxx; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | print '<tr>'; |
194 | 194 | print '<td width="110">'.$langs->trans("CalculationMode").'</td>'; |
195 | - if (! $variante) print '<td colspan="3">'; |
|
195 | + if (!$variante) print '<td colspan="3">'; |
|
196 | 196 | else print '<td>'; |
197 | 197 | print $calcmode; |
198 | 198 | if ($variante) print '</td><td colspan="2">'.$variante; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | // Ligne de la periode d'analyse du rapport |
204 | 204 | print '<tr>'; |
205 | 205 | print '<td>'.$langs->trans("ReportPeriod").'</td>'; |
206 | - if (! $periodlink) print '<td colspan="3">'; |
|
206 | + if (!$periodlink) print '<td colspan="3">'; |
|
207 | 207 | else print '<td>'; |
208 | 208 | if ($period) print $period; |
209 | 209 | if ($periodlink) print '</td><td colspan="2">'.$periodlink; |
@@ -35,17 +35,17 @@ discard block |
||
35 | 35 | $h = 0; |
36 | 36 | $head = array(); |
37 | 37 | |
38 | - $head[$h][0] = dol_buildpath('/resource/card.php',1).'?id='.$object->id; |
|
38 | + $head[$h][0] = dol_buildpath('/resource/card.php', 1).'?id='.$object->id; |
|
39 | 39 | $head[$h][1] = $langs->trans("ResourceCard"); |
40 | 40 | $head[$h][2] = 'resource'; |
41 | 41 | $h++; |
42 | 42 | |
43 | 43 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && (empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER) || empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY))) |
44 | 44 | { |
45 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
45 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
46 | 46 | $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id; |
47 | 47 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
48 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
48 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
49 | 49 | $head[$h][2] = 'contact'; |
50 | 50 | $h++; |
51 | 51 | } |
@@ -54,35 +54,35 @@ discard block |
||
54 | 54 | // Entries must be declared in modules descriptor with line |
55 | 55 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
56 | 56 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
57 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'resource'); |
|
57 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'resource'); |
|
58 | 58 | |
59 | 59 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
60 | 60 | { |
61 | 61 | $nbNote = 0; |
62 | - if(!empty($object->note_private)) $nbNote++; |
|
63 | - if(!empty($object->note_public)) $nbNote++; |
|
62 | + if (!empty($object->note_private)) $nbNote++; |
|
63 | + if (!empty($object->note_public)) $nbNote++; |
|
64 | 64 | $head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id; |
65 | 65 | $head[$h][1] = $langs->trans('Notes'); |
66 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
66 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
67 | 67 | $head[$h][2] = 'note'; |
68 | 68 | $h++; |
69 | 69 | } |
70 | 70 | |
71 | 71 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
72 | - $upload_dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
73 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
72 | + $upload_dir = $conf->resource->dir_output."/".dol_sanitizeFileName($object->ref); |
|
73 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
74 | 74 | $head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id; |
75 | 75 | $head[$h][1] = $langs->trans("Documents"); |
76 | - if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>'; |
|
76 | + if ($nbFiles > 0) $head[$h][1] .= ' <span class="badge">'.$nbFiles.'</span>'; |
|
77 | 77 | $head[$h][2] = 'documents'; |
78 | 78 | $h++; |
79 | 79 | |
80 | 80 | $head[$h][0] = DOL_URL_ROOT.'/resource/agenda.php?id='.$object->id; |
81 | 81 | $head[$h][1] = $langs->trans("Events"); |
82 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
82 | + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
|
83 | 83 | { |
84 | - $head[$h][1].= '/'; |
|
85 | - $head[$h][1].= $langs->trans("Agenda"); |
|
84 | + $head[$h][1] .= '/'; |
|
85 | + $head[$h][1] .= $langs->trans("Agenda"); |
|
86 | 86 | } |
87 | 87 | $head[$h][2] = 'agenda'; |
88 | 88 | $h++; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $head[$h][2] = 'info'; |
93 | 93 | $h++;*/ |
94 | 94 | |
95 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'resource', 'remove'); |
|
95 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'resource', 'remove'); |
|
96 | 96 | |
97 | 97 | return $head; |
98 | 98 | } |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | // Entries must be declared in modules descriptor with line |
120 | 120 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
121 | 121 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
122 | - complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin'); |
|
122 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'resource_admin'); |
|
123 | 123 | |
124 | 124 | $head[$h][0] = DOL_URL_ROOT.'/admin/resource_extrafields.php'; |
125 | 125 | $head[$h][1] = $langs->trans("ExtraFields"); |
126 | 126 | $head[$h][2] = 'attributes'; |
127 | 127 | $h++; |
128 | 128 | |
129 | - complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin','remove'); |
|
129 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'resource_admin', 'remove'); |
|
130 | 130 | |
131 | 131 | return $head; |
132 | 132 | } |
@@ -32,63 +32,63 @@ |
||
32 | 32 | * @param string $errorlabel Error string label |
33 | 33 | * @return User Return user object identified by login/pass/entity into authentication array |
34 | 34 | */ |
35 | -function check_authentication($authentication,&$error,&$errorcode,&$errorlabel) |
|
35 | +function check_authentication($authentication, &$error, &$errorcode, &$errorlabel) |
|
36 | 36 | { |
37 | - global $db,$conf,$langs; |
|
38 | - global $dolibarr_main_authentication,$dolibarr_auto_user; |
|
37 | + global $db, $conf, $langs; |
|
38 | + global $dolibarr_main_authentication, $dolibarr_auto_user; |
|
39 | 39 | |
40 | - $fuser=new User($db); |
|
40 | + $fuser = new User($db); |
|
41 | 41 | |
42 | - if (! $error && ($authentication['dolibarrkey'] != $conf->global->WEBSERVICES_KEY)) |
|
42 | + if (!$error && ($authentication['dolibarrkey'] != $conf->global->WEBSERVICES_KEY)) |
|
43 | 43 | { |
44 | 44 | $error++; |
45 | - $errorcode='BAD_VALUE_FOR_SECURITY_KEY'; $errorlabel='Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; |
|
45 | + $errorcode = 'BAD_VALUE_FOR_SECURITY_KEY'; $errorlabel = 'Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; |
|
46 | 46 | } |
47 | 47 | |
48 | - if (! $error && ! empty($authentication['entity']) && ! is_numeric($authentication['entity'])) |
|
48 | + if (!$error && !empty($authentication['entity']) && !is_numeric($authentication['entity'])) |
|
49 | 49 | { |
50 | 50 | $error++; |
51 | - $errorcode='BAD_PARAMETERS'; $errorlabel="The entity parameter must be empty (or filled with numeric id of instance if multicompany module is used)."; |
|
51 | + $errorcode = 'BAD_PARAMETERS'; $errorlabel = "The entity parameter must be empty (or filled with numeric id of instance if multicompany module is used)."; |
|
52 | 52 | } |
53 | 53 | |
54 | - if (! $error) |
|
54 | + if (!$error) |
|
55 | 55 | { |
56 | - $result=$fuser->fetch('',$authentication['login'],'',0); |
|
56 | + $result = $fuser->fetch('', $authentication['login'], '', 0); |
|
57 | 57 | if ($result < 0) |
58 | 58 | { |
59 | 59 | $error++; |
60 | - $errorcode='ERROR_FETCH_USER'; $errorlabel='A technical error occurred during fetch of user'; |
|
60 | + $errorcode = 'ERROR_FETCH_USER'; $errorlabel = 'A technical error occurred during fetch of user'; |
|
61 | 61 | } |
62 | 62 | else if ($result == 0) |
63 | 63 | { |
64 | 64 | $error++; |
65 | - $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password'; |
|
65 | + $errorcode = 'BAD_CREDENTIALS'; $errorlabel = 'Bad value for login or password'; |
|
66 | 66 | } |
67 | 67 | |
68 | - if (! $error && $fuser->statut == 0) |
|
68 | + if (!$error && $fuser->statut == 0) |
|
69 | 69 | { |
70 | 70 | $error++; |
71 | - $errorcode='ERROR_USER_DISABLED'; $errorlabel='This user has been locked or disabled'; |
|
71 | + $errorcode = 'ERROR_USER_DISABLED'; $errorlabel = 'This user has been locked or disabled'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // Validation of login |
75 | - if (! $error) |
|
75 | + if (!$error) |
|
76 | 76 | { |
77 | - $fuser->getrights(); // Load permission of user |
|
77 | + $fuser->getrights(); // Load permission of user |
|
78 | 78 | |
79 | 79 | // Authentication mode |
80 | - if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr'; |
|
80 | + if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'http,dolibarr'; |
|
81 | 81 | // Authentication mode: forceuser |
82 | - if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto'; |
|
82 | + if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user = 'auto'; |
|
83 | 83 | // Set authmode |
84 | - $authmode=explode(',',$dolibarr_main_authentication); |
|
84 | + $authmode = explode(',', $dolibarr_main_authentication); |
|
85 | 85 | |
86 | 86 | include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
87 | - $login = checkLoginPassEntity($authentication['login'],$authentication['password'],$authentication['entity'],$authmode); |
|
87 | + $login = checkLoginPassEntity($authentication['login'], $authentication['password'], $authentication['entity'], $authmode); |
|
88 | 88 | if (empty($login)) |
89 | 89 | { |
90 | 90 | $error++; |
91 | - $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password'; |
|
91 | + $errorcode = 'BAD_CREDENTIALS'; $errorlabel = 'Bad value for login or password'; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | |
49 | 49 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
50 | 50 | { |
51 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
51 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
52 | 52 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id; |
53 | 53 | $head[$h][1] = $langs->trans('InterventionContact'); |
54 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
55 | 55 | $head[$h][2] = 'contact'; |
56 | 56 | $h++; |
57 | 57 | } |
@@ -60,29 +60,29 @@ discard block |
||
60 | 60 | // Entries must be declared in modules descriptor with line |
61 | 61 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
62 | 62 | // $this->tabs = array('entity:-tabname); to remove a tab |
63 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention'); |
|
63 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention'); |
|
64 | 64 | |
65 | 65 | // Tab to link resources |
66 | 66 | if ($conf->resource->enabled) |
67 | 67 | { |
68 | 68 | require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; |
69 | 69 | $nbResource = 0; |
70 | - $objectres=new Dolresource($db); |
|
70 | + $objectres = new Dolresource($db); |
|
71 | 71 | if (is_array($objectres->available_resources)) |
72 | 72 | { |
73 | 73 | foreach ($objectres->available_resources as $modresources => $resources) |
74 | 74 | { |
75 | - $resources=(array) $resources; // To be sure $resources is an array |
|
76 | - foreach($resources as $resource_obj) |
|
75 | + $resources = (array) $resources; // To be sure $resources is an array |
|
76 | + foreach ($resources as $resource_obj) |
|
77 | 77 | { |
78 | - $linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj); |
|
78 | + $linked_resources = $object->getElementResources('fichinter', $object->id, $resource_obj); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | 83 | $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id; |
84 | 84 | $head[$h][1] = $langs->trans("Resources"); |
85 | - if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>'; |
|
85 | + if ($nbResource > 0) $head[$h][1] .= ' <span class="badge">'.$nbResource.'</span>'; |
|
86 | 86 | $head[$h][2] = 'resource'; |
87 | 87 | $h++; |
88 | 88 | } |
@@ -90,23 +90,23 @@ discard block |
||
90 | 90 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
91 | 91 | { |
92 | 92 | $nbNote = 0; |
93 | - if(!empty($object->note_private)) $nbNote++; |
|
94 | - if(!empty($object->note_public)) $nbNote++; |
|
93 | + if (!empty($object->note_private)) $nbNote++; |
|
94 | + if (!empty($object->note_public)) $nbNote++; |
|
95 | 95 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id; |
96 | 96 | $head[$h][1] = $langs->trans('Notes'); |
97 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
97 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
98 | 98 | $head[$h][2] = 'note'; |
99 | 99 | $h++; |
100 | 100 | } |
101 | 101 | |
102 | 102 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
103 | 103 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
104 | - $upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
105 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
106 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
104 | + $upload_dir = $conf->ficheinter->dir_output."/".dol_sanitizeFileName($object->ref); |
|
105 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
106 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
107 | 107 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id; |
108 | 108 | $head[$h][1] = $langs->trans("Documents"); |
109 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
109 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
110 | 110 | $head[$h][2] = 'documents'; |
111 | 111 | $h++; |
112 | 112 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $head[$h][2] = 'info'; |
116 | 116 | $h++; |
117 | 117 | |
118 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention','remove'); |
|
118 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention', 'remove'); |
|
119 | 119 | |
120 | 120 | return $head; |
121 | 121 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | // Entries must be declared in modules descriptor with line |
144 | 144 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
145 | 145 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
146 | - complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin'); |
|
146 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'fichinter_admin'); |
|
147 | 147 | |
148 | 148 | $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php'; |
149 | 149 | $head[$h][1] = $langs->trans("ExtraFields"); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | |
160 | - complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove'); |
|
160 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'fichinter_admin', 'remove'); |
|
161 | 161 | |
162 | 162 | return $head; |
163 | 163 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec'); |
184 | 184 | |
185 | - complete_head_from_modules($conf, $langs, $object, $head, $h,'intervention-rec','remove'); |
|
185 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec', 'remove'); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | return $head; |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | $head[$h][2] = 'card'; |
40 | 40 | $h++; |
41 | 41 | |
42 | - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient)) |
|
42 | + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient)) |
|
43 | 43 | { |
44 | 44 | $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id; |
45 | 45 | $head[$h][1] = $langs->trans("MailRecipients"); |
46 | - if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>'; |
|
46 | + if ($object->nbemail > 0) $head[$h][1] .= ' <span class="badge">'.$object->nbemail.'</span>'; |
|
47 | 47 | $head[$h][2] = 'targets'; |
48 | 48 | $h++; |
49 | 49 | } |
50 | 50 | |
51 | - if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) |
|
51 | + if (!empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) |
|
52 | 52 | { |
53 | 53 | $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id; |
54 | 54 | $head[$h][1] = $langs->trans("MailAdvTargetRecipients"); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | $head[$h][2] = 'info'; |
62 | 62 | $h++; |
63 | 63 | |
64 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing'); |
|
64 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing'); |
|
65 | 65 | |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing','remove'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing', 'remove'); |
|
67 | 67 | |
68 | 68 | return $head; |
69 | 69 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | function commande_prepare_head(Commande $object) |
35 | 35 | { |
36 | 36 | global $db, $langs, $conf, $user; |
37 | - if (! empty($conf->expedition->enabled)) $langs->load("sendings"); |
|
37 | + if (!empty($conf->expedition->enabled)) $langs->load("sendings"); |
|
38 | 38 | $langs->load("orders"); |
39 | 39 | |
40 | 40 | $h = 0; |
41 | 41 | $head = array(); |
42 | 42 | |
43 | - if (! empty($conf->commande->enabled) && $user->rights->commande->lire) |
|
43 | + if (!empty($conf->commande->enabled) && $user->rights->commande->lire) |
|
44 | 44 | { |
45 | 45 | $head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id; |
46 | 46 | $head[$h][1] = $langs->trans("OrderCard"); |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
52 | 52 | { |
53 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
53 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
54 | 54 | $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id; |
55 | 55 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
56 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
56 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
57 | 57 | $head[$h][2] = 'contact'; |
58 | 58 | $h++; |
59 | 59 | } |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) |
62 | 62 | || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) |
63 | 63 | { |
64 | - $nbShipments=$object->getNbOfShipments(); $nbReceiption=0; |
|
64 | + $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; |
|
65 | 65 | $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; |
66 | - $text=''; |
|
67 | - if ($conf->expedition_bon->enabled) $text.=$langs->trans("Shipments"); |
|
68 | - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; |
|
69 | - if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); |
|
70 | - if ($nbShipments > 0 || $nbReceiption > 0) $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0); |
|
71 | - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; |
|
72 | - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.= ($nbReceiption?$nbReceiption:0); |
|
73 | - if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>'; |
|
66 | + $text = ''; |
|
67 | + if ($conf->expedition_bon->enabled) $text .= $langs->trans("Shipments"); |
|
68 | + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text .= '/'; |
|
69 | + if ($conf->livraison_bon->enabled) $text .= $langs->trans("Receivings"); |
|
70 | + if ($nbShipments > 0 || $nbReceiption > 0) $text .= ' <span class="badge">'.($nbShipments ? $nbShipments : 0); |
|
71 | + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text .= '/'; |
|
72 | + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); |
|
73 | + if ($nbShipments > 0 || $nbReceiption > 0) $text .= '</span>'; |
|
74 | 74 | $head[$h][1] = $text; |
75 | 75 | $head[$h][2] = 'shipping'; |
76 | 76 | $h++; |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | // Entries must be declared in modules descriptor with line |
81 | 81 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
82 | 82 | // $this->tabs = array('entity:-tabname); to remove a tab |
83 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'order'); |
|
83 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'order'); |
|
84 | 84 | |
85 | 85 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 86 | { |
87 | 87 | $nbNote = 0; |
88 | - if(!empty($object->note_private)) $nbNote++; |
|
89 | - if(!empty($object->note_public)) $nbNote++; |
|
88 | + if (!empty($object->note_private)) $nbNote++; |
|
89 | + if (!empty($object->note_public)) $nbNote++; |
|
90 | 90 | $head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id; |
91 | 91 | $head[$h][1] = $langs->trans('Notes'); |
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
92 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | 93 | $head[$h][2] = 'note'; |
94 | 94 | $h++; |
95 | 95 | } |
96 | 96 | |
97 | 97 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
99 | + $upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
105 | 105 | $head[$h][2] = 'documents'; |
106 | 106 | $h++; |
107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $head[$h][2] = 'info'; |
111 | 111 | $h++; |
112 | 112 | |
113 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'order','remove'); |
|
113 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove'); |
|
114 | 114 | |
115 | 115 | return $head; |
116 | 116 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $head[$h][2] = 'general'; |
133 | 133 | $h++; |
134 | 134 | |
135 | - complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin'); |
|
135 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'order_admin'); |
|
136 | 136 | |
137 | 137 | $head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php'; |
138 | 138 | $head[$h][1] = $langs->trans("ExtraFields"); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $head[$h][2] = 'attributeslines'; |
145 | 145 | $h++; |
146 | 146 | |
147 | - complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin','remove'); |
|
147 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'order_admin', 'remove'); |
|
148 | 148 | |
149 | 149 | return $head; |
150 | 150 | } |