@@ -71,7 +71,10 @@ discard block |
||
71 | 71 | ); |
72 | 72 | |
73 | 73 | $requestedpermissionsarray=array(); |
74 | -if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
74 | +if (GETPOST('state')) { |
|
75 | + $requestedpermissionsarray=explode(',', GETPOST('state')); |
|
76 | +} |
|
77 | +// Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
75 | 78 | /*if ($action != 'delete' && empty($requestedpermissionsarray)) |
76 | 79 | { |
77 | 80 | print 'Error, parameter state is not defined'; |
@@ -107,12 +110,14 @@ discard block |
||
107 | 110 | exit(); |
108 | 111 | } |
109 | 112 | |
110 | -if (! empty($_GET['code'])) // We are coming from oauth provider page |
|
113 | +if (! empty($_GET['code'])) { |
|
114 | + // We are coming from oauth provider page |
|
111 | 115 | { |
112 | 116 | // We should have |
113 | 117 | //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) |
114 | 118 | |
115 | 119 | dol_syslog("We are coming from the oauth provider page"); |
120 | +} |
|
116 | 121 | //llxHeader('',$langs->trans("OAuthSetup")); |
117 | 122 | |
118 | 123 | //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
@@ -146,8 +151,7 @@ discard block |
||
146 | 151 | } catch (Exception $e) { |
147 | 152 | print $e->getMessage(); |
148 | 153 | } |
149 | -} |
|
150 | -else // If entry on page with no parameter, we arrive here |
|
154 | +} else // If entry on page with no parameter, we arrive here |
|
151 | 155 | { |
152 | 156 | $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; |
153 | 157 | |
@@ -156,8 +160,7 @@ discard block |
||
156 | 160 | if (GETPOST('state')) |
157 | 161 | { |
158 | 162 | $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); |
159 | - } |
|
160 | - else |
|
163 | + } else |
|
161 | 164 | { |
162 | 165 | //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated |
163 | 166 | //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write |
@@ -71,7 +71,10 @@ discard block |
||
71 | 71 | ); |
72 | 72 | |
73 | 73 | $requestedpermissionsarray=array(); |
74 | -if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
74 | +if (GETPOST('state')) { |
|
75 | + $requestedpermissionsarray=explode(',', GETPOST('state')); |
|
76 | +} |
|
77 | +// Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
75 | 78 | if ($action != 'delete' && empty($requestedpermissionsarray)) |
76 | 79 | { |
77 | 80 | print 'Error, parameter state is not defined'; |
@@ -107,9 +110,11 @@ discard block |
||
107 | 110 | exit(); |
108 | 111 | } |
109 | 112 | |
110 | -if (! empty($_GET['code'])) // We are coming from oauth provider page |
|
113 | +if (! empty($_GET['code'])) { |
|
114 | + // We are coming from oauth provider page |
|
111 | 115 | { |
112 | 116 | dol_syslog("We are coming from the oauth provider page"); |
117 | +} |
|
113 | 118 | //llxHeader('',$langs->trans("OAuthSetup")); |
114 | 119 | |
115 | 120 | //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
@@ -138,8 +143,7 @@ discard block |
||
138 | 143 | } catch (Exception $e) { |
139 | 144 | print $e->getMessage(); |
140 | 145 | } |
141 | -} |
|
142 | -else // If entry on page with no parameter, we arrive here |
|
146 | +} else // If entry on page with no parameter, we arrive here |
|
143 | 147 | { |
144 | 148 | $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; |
145 | 149 | |
@@ -148,8 +152,7 @@ discard block |
||
148 | 152 | if (GETPOST('state')) |
149 | 153 | { |
150 | 154 | $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); |
151 | - } |
|
152 | - else |
|
155 | + } else |
|
153 | 156 | { |
154 | 157 | $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated |
155 | 158 | } |
@@ -71,7 +71,10 @@ discard block |
||
71 | 71 | ); |
72 | 72 | |
73 | 73 | $requestedpermissionsarray=array(); |
74 | -if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
74 | +if (GETPOST('state')) { |
|
75 | + $requestedpermissionsarray=explode(',', GETPOST('state')); |
|
76 | +} |
|
77 | +// Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
75 | 78 | if ($action != 'delete' && empty($requestedpermissionsarray)) |
76 | 79 | { |
77 | 80 | print 'Error, parameter state is not defined'; |
@@ -104,12 +107,14 @@ discard block |
||
104 | 107 | exit(); |
105 | 108 | } |
106 | 109 | |
107 | -if (! empty($_GET['code'])) // We are coming from oauth provider page |
|
110 | +if (! empty($_GET['code'])) { |
|
111 | + // We are coming from oauth provider page |
|
108 | 112 | { |
109 | 113 | // We should have |
110 | 114 | //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) |
111 | 115 | |
112 | 116 | dol_syslog("We are coming from the oauth provider page"); |
117 | +} |
|
113 | 118 | //llxHeader('',$langs->trans("OAuthSetup")); |
114 | 119 | |
115 | 120 | //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
@@ -143,8 +148,7 @@ discard block |
||
143 | 148 | } catch (Exception $e) { |
144 | 149 | print $e->getMessage(); |
145 | 150 | } |
146 | -} |
|
147 | -else // If entry on page with no parameter, we arrive here |
|
151 | +} else // If entry on page with no parameter, we arrive here |
|
148 | 152 | { |
149 | 153 | $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; |
150 | 154 | |
@@ -153,8 +157,7 @@ discard block |
||
153 | 157 | if (GETPOST('state')) |
154 | 158 | { |
155 | 159 | $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); |
156 | - } |
|
157 | - else |
|
160 | + } else |
|
158 | 161 | { |
159 | 162 | $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated |
160 | 163 | } |
@@ -85,7 +85,10 @@ |
||
85 | 85 | global $langs; |
86 | 86 | $langs->load("printing"); |
87 | 87 | $transstring="PrintingModuleDesc".$this->name; |
88 | - if ($langs->trans($transstring) != $transstring) return $langs->trans($transstring); |
|
89 | - else return $this->desc; |
|
88 | + if ($langs->trans($transstring) != $transstring) { |
|
89 | + return $langs->trans($transstring); |
|
90 | + } else { |
|
91 | + return $this->desc; |
|
92 | + } |
|
90 | 93 | } |
91 | 94 | } |
@@ -149,12 +149,10 @@ discard block |
||
149 | 149 | if ($endoflife == $token::EOL_NEVER_EXPIRES) |
150 | 150 | { |
151 | 151 | $expiredat = $langs->trans("Never"); |
152 | - } |
|
153 | - elseif ($endoflife == $token::EOL_UNKNOWN) |
|
152 | + } elseif ($endoflife == $token::EOL_UNKNOWN) |
|
154 | 153 | { |
155 | 154 | $expiredat = $langs->trans("Unknown"); |
156 | - } |
|
157 | - else |
|
155 | + } else |
|
158 | 156 | { |
159 | 157 | $expiredat=dol_print_date($endoflife, "dayhour"); |
160 | 158 | } |
@@ -216,9 +214,9 @@ discard block |
||
216 | 214 | if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id']) |
217 | 215 | { |
218 | 216 | $html.= img_picto($langs->trans("Default"),'on'); |
217 | + } else { |
|
218 | + $html.= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&mode=test&varname=PRINTING_GCP_DEFAULT&driver=printgcp&value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; |
|
219 | 219 | } |
220 | - else |
|
221 | - $html.= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&mode=test&varname=PRINTING_GCP_DEFAULT&driver=printgcp&value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; |
|
222 | 220 | $html.= '</td>'; |
223 | 221 | $html.= '</tr>'."\n"; |
224 | 222 | } |
@@ -321,22 +319,21 @@ discard block |
||
321 | 319 | if ($obj) |
322 | 320 | { |
323 | 321 | $printer_id = $obj->printer_id; |
324 | - } |
|
325 | - else |
|
322 | + } else |
|
326 | 323 | { |
327 | 324 | if (! empty($conf->global->PRINTING_GCP_DEFAULT)) |
328 | 325 | { |
329 | 326 | $printer_id=$conf->global->PRINTING_GCP_DEFAULT; |
330 | - } |
|
331 | - else |
|
327 | + } else |
|
332 | 328 | { |
333 | 329 | $this->errors[] = 'NoDefaultPrinterDefined'; |
334 | 330 | $error++; |
335 | 331 | return $error; |
336 | 332 | } |
337 | 333 | } |
334 | + } else { |
|
335 | + dol_print_error($this->db); |
|
338 | 336 | } |
339 | - else dol_print_error($this->db); |
|
340 | 337 | |
341 | 338 | $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype); |
342 | 339 | $this->error = 'PRINTGCP: '.$ret['errormessage']; |
@@ -501,8 +498,7 @@ discard block |
||
501 | 498 | $html .= '<td> </td>'; |
502 | 499 | $html .= '</tr>'; |
503 | 500 | } |
504 | - } |
|
505 | - else |
|
501 | + } else |
|
506 | 502 | { |
507 | 503 | $html .= '<tr class="oddeven">'; |
508 | 504 | $html .= '<td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td>'; |
@@ -100,7 +100,9 @@ discard block |
||
100 | 100 | $ipp->setPort($this->port); |
101 | 101 | $ipp->setJobName($file,true); |
102 | 102 | $ipp->setUserName($this->userid); |
103 | - if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password); |
|
103 | + if (! empty($this->user)) { |
|
104 | + $ipp->setAuthentication($this->user,$this->password); |
|
105 | + } |
|
104 | 106 | |
105 | 107 | // select printer uri for module order, propal,... |
106 | 108 | $sql = "SELECT rowid,printer_id,copy FROM ".MAIN_DB_PREFIX."printing WHERE module = '".$module."' AND driver = 'printipp' AND userid = ".$user->id; |
@@ -111,15 +113,13 @@ discard block |
||
111 | 113 | { |
112 | 114 | dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id); |
113 | 115 | $ipp->setPrinterURI($obj->printer_id); |
114 | - } |
|
115 | - else |
|
116 | + } else |
|
116 | 117 | { |
117 | 118 | if (! empty($conf->global->PRINTIPP_URI_DEFAULT)) |
118 | 119 | { |
119 | 120 | dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".$conf->global->PRINTIPP_URI_DEFAULT); |
120 | 121 | $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); |
121 | - } |
|
122 | - else |
|
122 | + } else |
|
123 | 123 | { |
124 | 124 | $this->errors[] = 'NoDefaultPrinterDefined'; |
125 | 125 | $error++; |
@@ -133,7 +133,9 @@ discard block |
||
133 | 133 | // Set number of copy |
134 | 134 | $ipp->setCopies($obj->copy); |
135 | 135 | $fileprint=$conf->{$module}->dir_output; |
136 | - if ($subdir!='') $fileprint.='/'.$subdir; |
|
136 | + if ($subdir!='') { |
|
137 | + $fileprint.='/'.$subdir; |
|
138 | + } |
|
137 | 139 | $fileprint.='/'.$file; |
138 | 140 | $ipp->setData($fileprint); |
139 | 141 | try { |
@@ -142,7 +144,9 @@ discard block |
||
142 | 144 | $this->errors[] = $e->getMessage(); |
143 | 145 | $error++; |
144 | 146 | } |
145 | - if ($error==0) $this->errors[] = 'PRINTIPP: Job added'; |
|
147 | + if ($error==0) { |
|
148 | + $this->errors[] = 'PRINTIPP: Job added'; |
|
149 | + } |
|
146 | 150 | |
147 | 151 | return $error; |
148 | 152 | } |
@@ -173,42 +173,89 @@ discard block |
||
173 | 173 | 'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC", |
174 | 174 | 'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification' |
175 | 175 | ); |
176 | - if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; |
|
177 | - if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); |
|
178 | - if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); |
|
179 | - if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); |
|
176 | + if (is_object($mysoc) && $mysoc->useNPR()) { |
|
177 | + $this->export_fields_array[$r]['p.recuperableonly']='NPR'; |
|
178 | + } |
|
179 | + if (! empty($conf->stock->enabled)) { |
|
180 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); |
|
181 | + } |
|
182 | + if (! empty($conf->barcode->enabled)) { |
|
183 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); |
|
184 | + } |
|
185 | + if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) { |
|
186 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); |
|
187 | + } |
|
180 | 188 | $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; |
181 | 189 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
182 | - if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery')); |
|
183 | - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); |
|
184 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); |
|
185 | - if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; |
|
190 | + if (! empty($conf->fournisseur->enabled)) { |
|
191 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery')); |
|
192 | + } |
|
193 | + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) { |
|
194 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); |
|
195 | + } |
|
196 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
197 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); |
|
198 | + } |
|
199 | + if (! empty($conf->global->PRODUCT_USE_UNITS)) { |
|
200 | + $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; |
|
201 | + } |
|
186 | 202 | $this->export_TypeFields_array[$r]=array( |
187 | 203 | 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text", |
188 | 204 | 'p.note'=>"Text",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric", |
189 | 205 | 'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean", |
190 | 206 | 'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date' |
191 | 207 | ); |
192 | - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); |
|
193 | - if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); |
|
194 | - if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric')); |
|
195 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); |
|
196 | - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); |
|
208 | + if (! empty($conf->stock->enabled)) { |
|
209 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); |
|
210 | + } |
|
211 | + if (! empty($conf->barcode->enabled)) { |
|
212 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); |
|
213 | + } |
|
214 | + if (! empty($conf->fournisseur->enabled)) { |
|
215 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric')); |
|
216 | + } |
|
217 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
218 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); |
|
219 | + } |
|
220 | + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) { |
|
221 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); |
|
222 | + } |
|
197 | 223 | $this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
198 | - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); |
|
199 | - if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); |
|
200 | - if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); |
|
201 | - if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref')); |
|
202 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); |
|
203 | - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid'); |
|
224 | + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) { |
|
225 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); |
|
226 | + } |
|
227 | + if (! empty($conf->stock->enabled)) { |
|
228 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); |
|
229 | + } |
|
230 | + if (! empty($conf->barcode->enabled)) { |
|
231 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); |
|
232 | + } |
|
233 | + if (! empty($conf->fournisseur->enabled)) { |
|
234 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref')); |
|
235 | + } |
|
236 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
237 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); |
|
238 | + } |
|
239 | + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) { |
|
240 | + $this->export_dependencies_array[$r]=array('category'=>'p.rowid'); |
|
241 | + } |
|
204 | 242 | $this->export_sql_start[$r]='SELECT DISTINCT '; |
205 | 243 | $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; |
206 | - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; |
|
207 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid'; |
|
244 | + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) { |
|
245 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; |
|
246 | + } |
|
247 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
248 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid'; |
|
249 | + } |
|
208 | 250 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object'; |
209 | - if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; |
|
251 | + if (! empty($conf->fournisseur->enabled)) { |
|
252 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; |
|
253 | + } |
|
210 | 254 | $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')'; |
211 | - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields" |
|
255 | + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) { |
|
256 | + $this->export_sql_order[$r] =' GROUP BY p.rowid'; |
|
257 | + } |
|
258 | + // FIXME The group by used a generic value to say "all fields in select except function fields" |
|
212 | 259 | |
213 | 260 | if (! empty($conf->global->PRODUIT_MULTIPRICES)) |
214 | 261 | { |
@@ -223,7 +270,9 @@ discard block |
||
223 | 270 | 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", |
224 | 271 | 'pr.tva_tx'=>'PriceLevelVATRate', |
225 | 272 | 'pr.date_price'=>'DateCreation'); |
226 | - if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR'; |
|
273 | + if (is_object($mysoc) && $mysoc->useNPR()) { |
|
274 | + $this->export_fields_array[$r]['pr.recuperableonly']='NPR'; |
|
275 | + } |
|
227 | 276 | //$this->export_TypeFields_array[$r]=array( |
228 | 277 | // 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text", |
229 | 278 | // 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text', |
@@ -257,8 +306,12 @@ discard block |
||
257 | 306 | 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell", |
258 | 307 | 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification' |
259 | 308 | ); |
260 | - if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); |
|
261 | - if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); |
|
309 | + if (! empty($conf->stock->enabled)) { |
|
310 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); |
|
311 | + } |
|
312 | + if (! empty($conf->barcode->enabled)) { |
|
313 | + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); |
|
314 | + } |
|
262 | 315 | $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock')); |
263 | 316 | $this->export_TypeFields_array[$r]=array( |
264 | 317 | 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text", |
@@ -266,8 +319,12 @@ discard block |
||
266 | 319 | 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", |
267 | 320 | 'p.datec'=>'Date','p.tms'=>'Date' |
268 | 321 | ); |
269 | - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); |
|
270 | - if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); |
|
322 | + if (! empty($conf->stock->enabled)) { |
|
323 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); |
|
324 | + } |
|
325 | + if (! empty($conf->barcode->enabled)) { |
|
326 | + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); |
|
327 | + } |
|
271 | 328 | $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('pa.qty'=>'Numeric')); |
272 | 329 | $this->export_entities_array[$r]=array( |
273 | 330 | 'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct", |
@@ -276,8 +333,12 @@ discard block |
||
276 | 333 | 'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct", |
277 | 334 | 'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct" |
278 | 335 | ); |
279 | - if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct')); |
|
280 | - if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct')); |
|
336 | + if (! empty($conf->stock->enabled)) { |
|
337 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct')); |
|
338 | + } |
|
339 | + if (! empty($conf->barcode->enabled)) { |
|
340 | + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct')); |
|
341 | + } |
|
281 | 342 | $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct')); |
282 | 343 | $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; |
283 | 344 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
@@ -308,22 +369,38 @@ discard block |
||
308 | 369 | 'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC", |
309 | 370 | 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation' |
310 | 371 | ); |
311 | - if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); |
|
312 | - if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice')); |
|
313 | - if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR')); |
|
314 | - if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type')); |
|
315 | - if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type')); |
|
316 | - if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); |
|
317 | - if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; |
|
372 | + if (! empty($conf->stock->enabled)) { |
|
373 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); |
|
374 | + } |
|
375 | + if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) { |
|
376 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice')); |
|
377 | + } |
|
378 | + if (is_object($mysoc) && $mysoc->useNPR()) { |
|
379 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR')); |
|
380 | + } |
|
381 | + if (is_object($mysoc) && $mysoc->useLocalTax(1)) { |
|
382 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type')); |
|
383 | + } |
|
384 | + if (is_object($mysoc) && $mysoc->useLocalTax(2)) { |
|
385 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type')); |
|
386 | + } |
|
387 | + if (! empty($conf->barcode->enabled)) { |
|
388 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); |
|
389 | + } |
|
390 | + if (! empty($conf->global->PRODUCT_USE_UNITS)) { |
|
391 | + $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; |
|
392 | + } |
|
318 | 393 | // Add extra fields |
319 | 394 | $import_extrafield_sample=array(); |
320 | 395 | $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.")"; |
321 | 396 | $resql=$this->db->query($sql); |
322 | - if ($resql) // This can fail when class is used on old database (during migration for example) |
|
397 | + if ($resql) { |
|
398 | + // This can fail when class is used on old database (during migration for example) |
|
323 | 399 | { |
324 | 400 | while ($obj=$this->db->fetch_object($resql)) |
325 | 401 | { |
326 | 402 | $fieldname='extra.'.$obj->name; |
403 | + } |
|
327 | 404 | $fieldlabel=ucfirst($obj->label); |
328 | 405 | $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); |
329 | 406 | $import_extrafield_sample[$fieldname]=$fieldlabel; |
@@ -350,9 +427,15 @@ discard block |
||
350 | 427 | 'sp.fk_product'=>"ProductOrService*", |
351 | 428 | 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate', 'sp.default_vat_code'=>'VATCode' |
352 | 429 | ); |
353 | - if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.recuperableonly'=>'VATNPR')); |
|
354 | - if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); |
|
355 | - if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); |
|
430 | + if (is_object($mysoc) && $mysoc->useNPR()) { |
|
431 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.recuperableonly'=>'VATNPR')); |
|
432 | + } |
|
433 | + if (is_object($mysoc) && $mysoc->useLocalTax(1)) { |
|
434 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); |
|
435 | + } |
|
436 | + if (is_object($mysoc) && $mysoc->useLocalTax(2)) { |
|
437 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); |
|
438 | + } |
|
356 | 439 | $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array( |
357 | 440 | 'sp.price'=>"PriceQtyMinHT*", |
358 | 441 | 'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty |
@@ -387,7 +470,9 @@ discard block |
||
387 | 470 | 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", |
388 | 471 | 'pr.tva_tx'=>'PriceLevelVATRate', |
389 | 472 | 'pr.date_price'=>'DateCreation*'); |
390 | - if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR')); |
|
473 | + if (is_object($mysoc) && $mysoc->useNPR()) { |
|
474 | + $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR')); |
|
475 | + } |
|
391 | 476 | $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$'); |
392 | 477 | $this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1", |
393 | 478 | 'pr.price_base_type'=>"HT",'pr.price_level'=>"1", |
@@ -96,7 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | // Recupere emetteur |
98 | 98 | $this->emetteur=$mysoc; |
99 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
99 | + if (! $this->emetteur->country_code) { |
|
100 | + $this->emetteur->country_code=substr($langs->defaultlang,-2); |
|
101 | + } |
|
102 | + // By default if not defined |
|
100 | 103 | } |
101 | 104 | |
102 | 105 | |
@@ -140,11 +143,14 @@ discard block |
||
140 | 143 | if (! $tmpdir) { |
141 | 144 | unset($listofdir[$key]); continue; |
142 | 145 | } |
143 | - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
144 | - else |
|
146 | + if (! is_dir($tmpdir)) { |
|
147 | + $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); |
|
148 | + } else |
|
145 | 149 | { |
146 | 150 | $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); |
147 | - if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
151 | + if (count($tmpfiles)) { |
|
152 | + $listoffiles=array_merge($listoffiles,$tmpfiles); |
|
153 | + } |
|
148 | 154 | } |
149 | 155 | } |
150 | 156 | $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); |
@@ -237,7 +243,9 @@ discard block |
||
237 | 243 | $hookmanager->initHooks(array('odtgeneration')); |
238 | 244 | global $action; |
239 | 245 | |
240 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
246 | + if (! is_object($outputlangs)) { |
|
247 | + $outputlangs=$langs; |
|
248 | + } |
|
241 | 249 | $sav_charset_output=$outputlangs->charset_output; |
242 | 250 | $outputlangs->charset_output='UTF-8'; |
243 | 251 | |
@@ -264,7 +272,9 @@ discard block |
||
264 | 272 | |
265 | 273 | $dir = $conf->produit->dir_output; |
266 | 274 | $objectref = dol_sanitizeFileName($object->ref); |
267 | - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; |
|
275 | + if (! preg_match('/specimen/i',$objectref)) { |
|
276 | + $dir.= "/" . $objectref; |
|
277 | + } |
|
268 | 278 | $file = $dir . "/" . $objectref . ".odt"; |
269 | 279 | |
270 | 280 | if (! file_exists($dir)) |
@@ -291,10 +301,11 @@ discard block |
||
291 | 301 | if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) |
292 | 302 | { |
293 | 303 | $format=$conf->global->MAIN_DOC_USE_TIMING; |
294 | - if ($format == '1') $format='%Y%m%d%H%M%S'; |
|
304 | + if ($format == '1') { |
|
305 | + $format='%Y%m%d%H%M%S'; |
|
306 | + } |
|
295 | 307 | $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; |
296 | - } |
|
297 | - else |
|
308 | + } else |
|
298 | 309 | { |
299 | 310 | $filename=$newfiletmp.'.'.$newfileformat; |
300 | 311 | } |
@@ -321,14 +332,14 @@ discard block |
||
321 | 332 | if (! empty($usecontact)) |
322 | 333 | { |
323 | 334 | // On peut utiliser le nom de la societe du contact |
324 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; |
|
325 | - else { |
|
335 | + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { |
|
336 | + $socobject = $object->contact; |
|
337 | + } else { |
|
326 | 338 | $socobject = $object->thirdparty; |
327 | 339 | // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use |
328 | 340 | $contactobject = $object->contact; |
329 | 341 | } |
330 | - } |
|
331 | - else |
|
342 | + } else |
|
332 | 343 | { |
333 | 344 | $socobject=$object->thirdparty; |
334 | 345 | } |
@@ -365,8 +376,7 @@ discard block |
||
365 | 376 | 'DELIMITER_RIGHT' => '}' |
366 | 377 | ) |
367 | 378 | ); |
368 | - } |
|
369 | - catch(Exception $e) |
|
379 | + } catch(Exception $e) |
|
370 | 380 | { |
371 | 381 | $this->error=$e->getMessage(); |
372 | 382 | dol_syslog($e->getMessage(), LOG_INFO); |
@@ -383,8 +393,7 @@ discard block |
||
383 | 393 | // Make substitutions into odt of freetext |
384 | 394 | try { |
385 | 395 | $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); |
386 | - } |
|
387 | - catch (OdfException $e) |
|
396 | + } catch (OdfException $e) |
|
388 | 397 | { |
389 | 398 | dol_syslog($e->getMessage(), LOG_INFO); |
390 | 399 | } |
@@ -399,7 +408,9 @@ discard block |
||
399 | 408 | $array_other=$this->get_substitutionarray_other($outputlangs); |
400 | 409 | // retrieve contact information for use in stock as contact_xxx tags |
401 | 410 | $array_thirdparty_contact = array(); |
402 | - if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
411 | + if ($usecontact && is_object($contactobject)) { |
|
412 | + $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); |
|
413 | + } |
|
403 | 414 | |
404 | 415 | $tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); |
405 | 416 | complete_substitutions_array($tmparray, $outputlangs, $object); |
@@ -411,17 +422,18 @@ discard block |
||
411 | 422 | foreach($tmparray as $key=>$value) |
412 | 423 | { |
413 | 424 | try { |
414 | - if (preg_match('/logo$/',$key)) // Image |
|
425 | + if (preg_match('/logo$/',$key)) { |
|
426 | + // Image |
|
415 | 427 | { |
416 | 428 | if (file_exists($value)) $odfHandler->setImage($key, $value); |
417 | - else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
|
418 | - } |
|
419 | - else // Text |
|
429 | + } else { |
|
430 | + $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); |
|
431 | + } |
|
432 | + } else // Text |
|
420 | 433 | { |
421 | 434 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
422 | 435 | } |
423 | - } |
|
424 | - catch (OdfException $e) |
|
436 | + } catch (OdfException $e) |
|
425 | 437 | { |
426 | 438 | dol_syslog($e->getMessage(), LOG_INFO); |
427 | 439 | } |
@@ -443,12 +455,10 @@ discard block |
||
443 | 455 | try |
444 | 456 | { |
445 | 457 | $listlines->setVars($key, $val, true, 'UTF-8'); |
446 | - } |
|
447 | - catch(OdfException $e) |
|
458 | + } catch(OdfException $e) |
|
448 | 459 | { |
449 | 460 | dol_syslog($e->getMessage(), LOG_INFO); |
450 | - } |
|
451 | - catch(SegmentException $e) |
|
461 | + } catch(SegmentException $e) |
|
452 | 462 | { |
453 | 463 | dol_syslog($e->getMessage(), LOG_INFO); |
454 | 464 | } |
@@ -457,8 +467,7 @@ discard block |
||
457 | 467 | } |
458 | 468 | } |
459 | 469 | $odfHandler->mergeSegment($listlines); |
460 | - } |
|
461 | - catch(OdfException $e) |
|
470 | + } catch(OdfException $e) |
|
462 | 471 | { |
463 | 472 | $this->error=$e->getMessage(); |
464 | 473 | dol_syslog($this->error, LOG_WARNING); |
@@ -471,8 +480,7 @@ discard block |
||
471 | 480 | { |
472 | 481 | try { |
473 | 482 | $odfHandler->setVars($key, $value, true, 'UTF-8'); |
474 | - } |
|
475 | - catch(OdfException $e) |
|
483 | + } catch(OdfException $e) |
|
476 | 484 | { |
477 | 485 | dol_syslog($e->getMessage(), LOG_INFO); |
478 | 486 | } |
@@ -491,8 +499,7 @@ discard block |
||
491 | 499 | dol_syslog($e->getMessage(), LOG_INFO); |
492 | 500 | return -1; |
493 | 501 | } |
494 | - } |
|
495 | - else { |
|
502 | + } else { |
|
496 | 503 | try { |
497 | 504 | $odfHandler->saveToDisk($file); |
498 | 505 | } catch (Exception $e) { |
@@ -504,16 +511,16 @@ discard block |
||
504 | 511 | |
505 | 512 | $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
506 | 513 | |
507 | - if (! empty($conf->global->MAIN_UMASK)) |
|
508 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
514 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
515 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
516 | + } |
|
509 | 517 | |
510 | 518 | $odfHandler=null; // Destroy object |
511 | 519 | |
512 | 520 | $this->result = array('fullpath'=>$file); |
513 | 521 | |
514 | 522 | return 1; // Success |
515 | - } |
|
516 | - else |
|
523 | + } else |
|
517 | 524 | { |
518 | 525 | $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
519 | 526 | return -1; |
@@ -144,7 +144,10 @@ discard block |
||
144 | 144 | |
145 | 145 | // Recupere emetteur |
146 | 146 | $this->emetteur=$mysoc; |
147 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
147 | + if (! $this->emetteur->country_code) { |
|
148 | + $this->emetteur->country_code=substr($langs->defaultlang,-2); |
|
149 | + } |
|
150 | + // By default if not defined |
|
148 | 151 | |
149 | 152 | // Define position of columns |
150 | 153 | $this->wref = 15; |
@@ -157,11 +160,15 @@ discard block |
||
157 | 160 | $this->posxdiscount=155; |
158 | 161 | $this->postotalht=175; |
159 | 162 | |
160 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; |
|
163 | + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { |
|
164 | + $this->posxtva=$this->posxup; |
|
165 | + } |
|
161 | 166 | $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
162 | - if ($this->page_largeur < 210) // To work with US executive format |
|
167 | + if ($this->page_largeur < 210) { |
|
168 | + // To work with US executive format |
|
163 | 169 | { |
164 | 170 | $this->posxpicture-=20; |
171 | + } |
|
165 | 172 | $this->posxtva-=20; |
166 | 173 | $this->posxup-=20; |
167 | 174 | $this->posxqty-=20; |
@@ -194,9 +201,13 @@ discard block |
||
194 | 201 | // phpcs:enable |
195 | 202 | global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
196 | 203 | |
197 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
204 | + if (! is_object($outputlangs)) { |
|
205 | + $outputlangs=$langs; |
|
206 | + } |
|
198 | 207 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
199 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
208 | + if (! empty($conf->global->MAIN_USE_FPDF)) { |
|
209 | + $outputlangs->charset_output='ISO-8859-1'; |
|
210 | + } |
|
200 | 211 | |
201 | 212 | // Load traductions files requiredby by page |
202 | 213 | $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries")); |
@@ -210,8 +221,7 @@ discard block |
||
210 | 221 | { |
211 | 222 | $dir = $conf->stock->dir_output; |
212 | 223 | $file = $dir . "/SPECIMEN.pdf"; |
213 | - } |
|
214 | - else |
|
224 | + } else |
|
215 | 225 | { |
216 | 226 | $objectref = dol_sanitizeFileName($object->ref); |
217 | 227 | $dir = $conf->stock->dir_output . "/" . $objectref; |
@@ -277,14 +287,18 @@ discard block |
||
277 | 287 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
278 | 288 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
279 | 289 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->libelle)); |
280 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
290 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
291 | + $pdf->SetCompression(false); |
|
292 | + } |
|
281 | 293 | |
282 | 294 | $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
283 | 295 | |
284 | 296 | |
285 | 297 | // New page |
286 | 298 | $pdf->AddPage(); |
287 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
299 | + if (! empty($tplidx)) { |
|
300 | + $pdf->useTemplate($tplidx); |
|
301 | + } |
|
288 | 302 | $pagenb++; |
289 | 303 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
290 | 304 | $pdf->SetFont('','', $default_font_size - 1); |
@@ -329,9 +343,11 @@ discard block |
||
329 | 343 | $objp = $db->fetch_object($resql); |
330 | 344 | |
331 | 345 | // Multilangs |
332 | - if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active |
|
346 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
347 | + // si l'option est active |
|
333 | 348 | { |
334 | 349 | $sql = "SELECT label"; |
350 | + } |
|
335 | 351 | $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; |
336 | 352 | $sql.= " WHERE fk_product=".$objp->rowid; |
337 | 353 | $sql.= " AND lang='". $langs->getDefaultLang() ."'"; |
@@ -341,7 +357,9 @@ discard block |
||
341 | 357 | if ($result) |
342 | 358 | { |
343 | 359 | $objtp = $db->fetch_object($result); |
344 | - if ($objtp->label != '') $objp->produit = $objtp->label; |
|
360 | + if ($objtp->label != '') { |
|
361 | + $objp->produit = $objtp->label; |
|
362 | + } |
|
345 | 363 | } |
346 | 364 | } |
347 | 365 | |
@@ -361,32 +379,38 @@ discard block |
||
361 | 379 | $pdf->startTransaction(); |
362 | 380 | pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); |
363 | 381 | $pageposafter=$pdf->getPage(); |
364 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
382 | + if ($pageposafter > $pageposbefore) { |
|
383 | + // There is a pagebreak |
|
365 | 384 | { |
366 | 385 | $pdf->rollbackTransaction(true); |
386 | + } |
|
367 | 387 | $pageposafter=$pageposbefore; |
368 | 388 | //print $pageposafter.'-'.$pageposbefore;exit; |
369 | 389 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
370 | 390 | pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); |
371 | 391 | $pageposafter=$pdf->getPage(); |
372 | 392 | $posyafter=$pdf->GetY(); |
373 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
393 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) { |
|
394 | + // There is no space left for total+free text |
|
374 | 395 | { |
375 | 396 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
376 | 397 | { |
377 | 398 | $pdf->AddPage('','',true); |
378 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
379 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
399 | + } |
|
400 | + if (! empty($tplidx)) { |
|
401 | + $pdf->useTemplate($tplidx); |
|
402 | + } |
|
403 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
404 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
405 | + } |
|
380 | 406 | $pdf->setPage($pageposafter+1); |
381 | 407 | } |
382 | - } |
|
383 | - else |
|
408 | + } else |
|
384 | 409 | { |
385 | 410 | // We found a page break |
386 | 411 | $showpricebeforepagebreak=0; |
387 | 412 | } |
388 | - } |
|
389 | - else // No pagebreak |
|
413 | + } else // No pagebreak |
|
390 | 414 | { |
391 | 415 | $pdf->commitTransaction(); |
392 | 416 | } |
@@ -470,8 +494,7 @@ discard block |
||
470 | 494 | if ($pagenb == 1) |
471 | 495 | { |
472 | 496 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); |
473 | - } |
|
474 | - else |
|
497 | + } else |
|
475 | 498 | { |
476 | 499 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); |
477 | 500 | } |
@@ -479,24 +502,29 @@ discard block |
||
479 | 502 | $pagenb++; |
480 | 503 | $pdf->setPage($pagenb); |
481 | 504 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
482 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
505 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
506 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
507 | + } |
|
483 | 508 | } |
484 | 509 | if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
485 | 510 | { |
486 | 511 | if ($pagenb == 1) |
487 | 512 | { |
488 | 513 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); |
489 | - } |
|
490 | - else |
|
514 | + } else |
|
491 | 515 | { |
492 | 516 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); |
493 | 517 | } |
494 | 518 | $this->_pagefoot($pdf,$object,$outputlangs,1); |
495 | 519 | // New page |
496 | 520 | $pdf->AddPage(); |
497 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
521 | + if (! empty($tplidx)) { |
|
522 | + $pdf->useTemplate($tplidx); |
|
523 | + } |
|
498 | 524 | $pagenb++; |
499 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
525 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
526 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
527 | + } |
|
500 | 528 | } |
501 | 529 | } |
502 | 530 | |
@@ -538,8 +566,7 @@ discard block |
||
538 | 566 | $pdf->SetXY($this->postotalht, $curY); |
539 | 567 | $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, price(price2num($totalvaluesell,'MT'), 0, $outputlangs), 0, 'R', 0); |
540 | 568 | } |
541 | - } |
|
542 | - else |
|
569 | + } else |
|
543 | 570 | { |
544 | 571 | dol_print_error($db); |
545 | 572 | } |
@@ -563,8 +590,7 @@ discard block |
||
563 | 590 | |
564 | 591 | $tab_height = $tab_height - $height_note; |
565 | 592 | $tab_top = $nexY+6; |
566 | - } |
|
567 | - else |
|
593 | + } else |
|
568 | 594 | { |
569 | 595 | $height_note=0; |
570 | 596 | } |
@@ -776,8 +802,7 @@ discard block |
||
776 | 802 | { |
777 | 803 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
778 | 804 | $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
779 | - } |
|
780 | - else |
|
805 | + } else |
|
781 | 806 | { |
782 | 807 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); |
783 | 808 | $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
@@ -793,7 +818,9 @@ discard block |
||
793 | 818 | |
794 | 819 | // Pied de page |
795 | 820 | $this->_pagefoot($pdf,$object,$outputlangs); |
796 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
821 | + if (method_exists($pdf,'AliasNbPages')) { |
|
822 | + $pdf->AliasNbPages(); |
|
823 | + } |
|
797 | 824 | |
798 | 825 | $pdf->Close(); |
799 | 826 | |
@@ -805,20 +832,19 @@ discard block |
||
805 | 832 | global $action; |
806 | 833 | $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
807 | 834 | |
808 | - if (! empty($conf->global->MAIN_UMASK)) |
|
809 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
835 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
836 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
837 | + } |
|
810 | 838 | |
811 | 839 | $this->result = array('fullpath'=>$file); |
812 | 840 | |
813 | 841 | return 1; // Pas d'erreur |
814 | - } |
|
815 | - else |
|
842 | + } else |
|
816 | 843 | { |
817 | 844 | $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
818 | 845 | return 0; |
819 | 846 | } |
820 | - } |
|
821 | - else |
|
847 | + } else |
|
822 | 848 | { |
823 | 849 | $this->error=$langs->trans("ErrorConstantNotDefined","PRODUCT_OUTPUTDIR"); |
824 | 850 | return 0; |
@@ -845,7 +871,9 @@ discard block |
||
845 | 871 | |
846 | 872 | // Force to disable hidetop and hidebottom |
847 | 873 | $hidebottom=0; |
848 | - if ($hidetop) $hidetop=-1; |
|
874 | + if ($hidetop) { |
|
875 | + $hidetop=-1; |
|
876 | + } |
|
849 | 877 | |
850 | 878 | $currency = !empty($currency) ? $currency : $conf->currency; |
851 | 879 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -861,7 +889,9 @@ discard block |
||
861 | 889 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
862 | 890 | |
863 | 891 | //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; |
864 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
892 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
893 | + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
894 | + } |
|
865 | 895 | } |
866 | 896 | |
867 | 897 | $pdf->SetDrawColor(128,128,128); |
@@ -952,8 +982,11 @@ discard block |
||
952 | 982 | |
953 | 983 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
954 | 984 | |
955 | - if ($object->type == 1) $titlekey='ServiceSheet'; |
|
956 | - else $titlekey='StockSheet'; |
|
985 | + if ($object->type == 1) { |
|
986 | + $titlekey='ServiceSheet'; |
|
987 | + } else { |
|
988 | + $titlekey='StockSheet'; |
|
989 | + } |
|
957 | 990 | |
958 | 991 | pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
959 | 992 | |
@@ -979,16 +1012,14 @@ discard block |
||
979 | 1012 | { |
980 | 1013 | $height=pdf_getHeightForLogo($logo); |
981 | 1014 | $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
982 | - } |
|
983 | - else |
|
1015 | + } else |
|
984 | 1016 | { |
985 | 1017 | $pdf->SetTextColor(200,0,0); |
986 | 1018 | $pdf->SetFont('','B', $default_font_size -2); |
987 | 1019 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
988 | 1020 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
989 | 1021 | } |
990 | - } |
|
991 | - else |
|
1022 | + } else |
|
992 | 1023 | { |
993 | 1024 | $text=$this->emetteur->name; |
994 | 1025 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1031,8 +1062,7 @@ discard block |
||
1031 | 1062 | if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) |
1032 | 1063 | { |
1033 | 1064 | $pdf->MultiCell(150, 3, $e->libelle, '', 'R'); |
1034 | - } |
|
1035 | - else |
|
1065 | + } else |
|
1036 | 1066 | { |
1037 | 1067 | $pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R'); |
1038 | 1068 | } |
@@ -1070,8 +1100,7 @@ discard block |
||
1070 | 1100 | { |
1071 | 1101 | $obj = $db->fetch_object($resqlbis); |
1072 | 1102 | $lastmovementdate=$db->jdate($obj->datem); |
1073 | - } |
|
1074 | - else |
|
1103 | + } else |
|
1075 | 1104 | { |
1076 | 1105 | dol_print_error($db); |
1077 | 1106 | } |
@@ -1079,8 +1108,7 @@ discard block |
||
1079 | 1108 | if ($lastmovementdate) |
1080 | 1109 | { |
1081 | 1110 | $toWrite = dol_print_date($lastmovementdate,'dayhour').' '; |
1082 | - } |
|
1083 | - else |
|
1111 | + } else |
|
1084 | 1112 | { |
1085 | 1113 | $toWrite = $outputlangs->transnoentities("None"); |
1086 | 1114 | } |