@@ -221,7 +221,7 @@ |
||
221 | 221 | |
222 | 222 | if (!$notrigger) { |
223 | 223 | // Call triggers |
224 | - $result=$this->call_trigger('LINERECEPTION_CREATE', $user); |
|
224 | + $result = $this->call_trigger('LINERECEPTION_CREATE', $user); |
|
225 | 225 | if ($result < 0) { |
226 | 226 | $error++; |
227 | 227 | } |
@@ -51,7 +51,9 @@ |
||
51 | 51 | $object->fetch($id); |
52 | 52 | $object->fetch_thirdparty(); |
53 | 53 | $result = $object->add_object_linked($addlink, $objecttmp->id); |
54 | - if (isset($_POST['reftolinkto'])) unset($_POST['reftolinkto']); |
|
54 | + if (isset($_POST['reftolinkto'])) { |
|
55 | + unset($_POST['reftolinkto']); |
|
56 | + } |
|
55 | 57 | } elseif ($ret < 0) { |
56 | 58 | setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); |
57 | 59 | } else { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) && !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) { |
44 | 44 | $element_prop = getElementProperties($addlink); |
45 | 45 | if (is_array($element_prop)) { |
46 | - dol_include_once('/' . $element_prop['classpath'] . '/' . $element_prop['classfile'] . '.class.php'); |
|
46 | + dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); |
|
47 | 47 | |
48 | 48 | $objecttmp = new $element_prop['classname']($db); |
49 | 49 | $ret = $objecttmp->fetch(0, $addlinkref); |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | if (!empty($object->refuse_note)) { |
555 | 555 | $object->actionmsg .= '<br>'; |
556 | - $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note; |
|
556 | + $object->actionmsg .= $langs->trans("Reason").': '.$object->refuse_note; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | $object->sendtoid = 0; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | if (!empty($object->cancel_note)) { |
570 | 570 | $object->actionmsg .= '<br>'; |
571 | - $object->actionmsg .= $langs->trans("Reason") . ': '.$object->cancel_note; |
|
571 | + $object->actionmsg .= $langs->trans("Reason").': '.$object->cancel_note; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | $object->sendtoid = 0; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | |
584 | 584 | if (!empty($object->context['comments'])) { |
585 | 585 | $object->actionmsg .= '<br>'; |
586 | - $object->actionmsg .= $langs->trans("Comment") . ': '.$object->context['comments']; |
|
586 | + $object->actionmsg .= $langs->trans("Comment").': '.$object->context['comments']; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | $object->sendtoid = 0; |
@@ -191,7 +191,9 @@ |
||
191 | 191 | // Load translation files required by the page |
192 | 192 | $langs->loadLangs(array("agenda", "other", "propal")); |
193 | 193 | |
194 | - if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
194 | + if (empty($object->actionmsg2)) { |
|
195 | + $object->actionmsg2 = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
|
196 | + } |
|
195 | 197 | $object->actionmsg = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref)); |
196 | 198 | |
197 | 199 | $object->sendtoid = 0; |
@@ -34,22 +34,22 @@ |
||
34 | 34 | $total = 0; |
35 | 35 | foreach ($linkedObjectBlock as $key => $objectlink) { |
36 | 36 | echo '<tr class="oddeven">'; |
37 | - echo '<td>' . $langs->trans(get_class($objectlink)) . '</td>'; |
|
37 | + echo '<td>'.$langs->trans(get_class($objectlink)).'</td>'; |
|
38 | 38 | echo '<td>'.$objectlink->getNomUrl(1).'</td>'; |
39 | 39 | echo '<td class="center">'; |
40 | - if (get_class($objectlink)=='ConferenceOrBooth') { |
|
40 | + if (get_class($objectlink) == 'ConferenceOrBooth') { |
|
41 | 41 | print dol_trunc($objectlink->label, 20); |
42 | 42 | } |
43 | 43 | print '</td>'; |
44 | 44 | echo '<td class="center">'; |
45 | - if (get_class($objectlink)=='ConferenceOrBoothAttendee') { |
|
45 | + if (get_class($objectlink) == 'ConferenceOrBoothAttendee') { |
|
46 | 46 | print dol_print_date($objectlink->date_subscription); |
47 | 47 | } else { |
48 | 48 | print dol_print_date($objectlink->datep); |
49 | 49 | } |
50 | 50 | print '</td>'; |
51 | 51 | echo '<td class="right">'; |
52 | - if (get_class($objectlink)=='ConferenceOrBoothAttendee') { |
|
52 | + if (get_class($objectlink) == 'ConferenceOrBoothAttendee') { |
|
53 | 53 | print price($objectlink->amount); |
54 | 54 | } |
55 | 55 | print '</td>'; |
@@ -102,8 +102,8 @@ |
||
102 | 102 | |
103 | 103 | |
104 | 104 | // List of targets fields |
105 | -$headerlinefields = array(); // Array of fields (label to show) |
|
106 | -$contentlinevalues = array(); // Array of example values |
|
105 | +$headerlinefields = array(); // Array of fields (label to show) |
|
106 | +$contentlinevalues = array(); // Array of example values |
|
107 | 107 | $i = 0; |
108 | 108 | foreach ($fieldstarget as $code => $label) { |
109 | 109 | $withoutstar = preg_replace('/\*/', '', $fieldstarget[$code]); |
@@ -622,15 +622,15 @@ |
||
622 | 622 | */ |
623 | 623 | |
624 | 624 | /** |
625 | - * Close a shipment (Classify it as "Delivered") |
|
626 | - * |
|
627 | - * @param int $id Expedition ID |
|
628 | - * @param int $notrigger Disabled triggers |
|
629 | - * |
|
630 | - * @url POST {id}/close |
|
631 | - * |
|
632 | - * @return int |
|
633 | - */ |
|
625 | + * Close a shipment (Classify it as "Delivered") |
|
626 | + * |
|
627 | + * @param int $id Expedition ID |
|
628 | + * @param int $notrigger Disabled triggers |
|
629 | + * |
|
630 | + * @url POST {id}/close |
|
631 | + * |
|
632 | + * @return int |
|
633 | + */ |
|
634 | 634 | public function close($id, $notrigger = 0) |
635 | 635 | { |
636 | 636 | if (!DolibarrApiAccess::$user->rights->expedition->creer) { |
@@ -262,10 +262,10 @@ |
||
262 | 262 | public $finished; |
263 | 263 | |
264 | 264 | /** |
265 | - * fk_default_bom indicates the default bom |
|
266 | - * |
|
267 | - * @var int |
|
268 | - */ |
|
265 | + * fk_default_bom indicates the default bom |
|
266 | + * |
|
267 | + * @var int |
|
268 | + */ |
|
269 | 269 | public $fk_default_bom; |
270 | 270 | |
271 | 271 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public $price; |
135 | 135 | |
136 | - public $price_formated; // used by takepos/ajax/ajax.php |
|
136 | + public $price_formated; // used by takepos/ajax/ajax.php |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Selling price with tax |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public $price_ttc; |
144 | 144 | |
145 | - public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
145 | + public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Minimum price net |
@@ -342,20 +342,20 @@ discard block |
||
342 | 342 | |
343 | 343 | //! Metric of products |
344 | 344 | public $weight; |
345 | - public $weight_units; // scale -3, 0, 3, 6 |
|
345 | + public $weight_units; // scale -3, 0, 3, 6 |
|
346 | 346 | public $length; |
347 | - public $length_units; // scale -3, 0, 3, 6 |
|
347 | + public $length_units; // scale -3, 0, 3, 6 |
|
348 | 348 | public $width; |
349 | - public $width_units; // scale -3, 0, 3, 6 |
|
349 | + public $width_units; // scale -3, 0, 3, 6 |
|
350 | 350 | public $height; |
351 | - public $height_units; // scale -3, 0, 3, 6 |
|
351 | + public $height_units; // scale -3, 0, 3, 6 |
|
352 | 352 | public $surface; |
353 | - public $surface_units; // scale -3, 0, 3, 6 |
|
353 | + public $surface_units; // scale -3, 0, 3, 6 |
|
354 | 354 | public $volume; |
355 | - public $volume_units; // scale -3, 0, 3, 6 |
|
355 | + public $volume_units; // scale -3, 0, 3, 6 |
|
356 | 356 | |
357 | 357 | public $net_measure; |
358 | - public $net_measure_units; // scale -3, 0, 3, 6 |
|
358 | + public $net_measure_units; // scale -3, 0, 3, 6 |
|
359 | 359 | |
360 | 360 | public $accountancy_code_sell; |
361 | 361 | public $accountancy_code_sell_intra; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), |
534 | 534 | //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), |
535 | 535 | //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), |
536 | - 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
536 | + 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
537 | 537 | ); |
538 | 538 | |
539 | 539 | /** |
@@ -823,9 +823,9 @@ discard block |
||
823 | 823 | |
824 | 824 | // update accountancy for this entity |
825 | 825 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
826 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
826 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
827 | 827 | |
828 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
828 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
829 | 829 | $sql .= " fk_product"; |
830 | 830 | $sql .= ", entity"; |
831 | 831 | $sql .= ", accountancy_code_buy"; |
@@ -836,13 +836,13 @@ discard block |
||
836 | 836 | $sql .= ", accountancy_code_sell_export"; |
837 | 837 | $sql .= ") VALUES ("; |
838 | 838 | $sql .= $this->id; |
839 | - $sql .= ", " . $conf->entity; |
|
840 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
841 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
842 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
843 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
844 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
845 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
839 | + $sql .= ", ".$conf->entity; |
|
840 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
841 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
842 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
843 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
844 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
845 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
846 | 846 | $sql .= ")"; |
847 | 847 | $result = $this->db->query($sql); |
848 | 848 | if (!$result) { |
@@ -1202,12 +1202,12 @@ discard block |
||
1202 | 1202 | $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); |
1203 | 1203 | $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; |
1204 | 1204 | if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
1205 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1206 | - $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1207 | - $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1208 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1209 | - $sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1210 | - $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1205 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1206 | + $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1207 | + $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1208 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1209 | + $sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1210 | + $sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1211 | 1211 | } |
1212 | 1212 | $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); |
1213 | 1213 | $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | $sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1); |
1216 | 1216 | $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); |
1217 | 1217 | $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); |
1218 | - $sql .= ", mandatory_period = ".($this->mandatory_period ); |
|
1218 | + $sql .= ", mandatory_period = ".($this->mandatory_period); |
|
1219 | 1219 | // stock field is not here because it is a denormalized value from product_stock. |
1220 | 1220 | $sql .= " WHERE rowid = ".((int) $id); |
1221 | 1221 | |
@@ -1237,9 +1237,9 @@ discard block |
||
1237 | 1237 | |
1238 | 1238 | // update accountancy for this entity |
1239 | 1239 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
1240 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
1240 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
1241 | 1241 | |
1242 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
1242 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
1243 | 1243 | $sql .= " fk_product"; |
1244 | 1244 | $sql .= ", entity"; |
1245 | 1245 | $sql .= ", accountancy_code_buy"; |
@@ -1250,13 +1250,13 @@ discard block |
||
1250 | 1250 | $sql .= ", accountancy_code_sell_export"; |
1251 | 1251 | $sql .= ") VALUES ("; |
1252 | 1252 | $sql .= $this->id; |
1253 | - $sql .= ", " . $conf->entity; |
|
1254 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1255 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1256 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1257 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1258 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1259 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1253 | + $sql .= ", ".$conf->entity; |
|
1254 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1255 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1256 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1257 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1258 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1259 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1260 | 1260 | $sql .= ")"; |
1261 | 1261 | $result = $this->db->query($sql); |
1262 | 1262 | if (!$result) { |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | private function getArrayForPriceCompare($level = 0) |
1743 | 1743 | { |
1744 | 1744 | |
1745 | - $testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly'); |
|
1745 | + $testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly'); |
|
1746 | 1746 | |
1747 | 1747 | foreach ($testExit as $field) { |
1748 | 1748 | if (!isset($this->$field)) { |
@@ -2365,20 +2365,20 @@ discard block |
||
2365 | 2365 | |
2366 | 2366 | //For MultiCompany |
2367 | 2367 | //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity |
2368 | - $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
2369 | - $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. |
|
2368 | + $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
2369 | + $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. |
|
2370 | 2370 | $visibleWarehousesEntities = $conf->entity; |
2371 | 2371 | if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { |
2372 | 2372 | if (!empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { |
2373 | - $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
2374 | - if ($this->db->num_rows($checkPMPPerEntity)>0) { |
|
2373 | + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
2374 | + if ($this->db->num_rows($checkPMPPerEntity) > 0) { |
|
2375 | 2375 | $separatedEntityPMP = true; |
2376 | 2376 | } |
2377 | 2377 | } |
2378 | 2378 | global $mc; |
2379 | 2379 | $separatedStock = true; |
2380 | 2380 | if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { |
2381 | - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); |
|
2381 | + $visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']); |
|
2382 | 2382 | } |
2383 | 2383 | } |
2384 | 2384 | if ($separatedEntityPMP) { |
@@ -2395,10 +2395,10 @@ discard block |
||
2395 | 2395 | } |
2396 | 2396 | $sql .= " FROM ".$this->db->prefix()."product as p"; |
2397 | 2397 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) || $separatedEntityPMP) { |
2398 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
2398 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
2399 | 2399 | } |
2400 | 2400 | if ($separatedStock) { |
2401 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; |
|
2401 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | if ($id) { |
@@ -2553,15 +2553,15 @@ discard block |
||
2553 | 2553 | $sql .= " WHERE entity IN (".getEntity('productprice').")"; |
2554 | 2554 | $sql .= " AND price_level=".((int) $i); |
2555 | 2555 | $sql .= " AND fk_product = ".((int) $this->id); |
2556 | - $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
2557 | - $sql .= " LIMIT 1"; // Only the first one |
|
2556 | + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
2557 | + $sql .= " LIMIT 1"; // Only the first one |
|
2558 | 2558 | $resql = $this->db->query($sql); |
2559 | 2559 | if ($resql) { |
2560 | 2560 | $result = $this->db->fetch_array($resql); |
2561 | 2561 | |
2562 | 2562 | $this->multiprices[$i] = $result ? $result["price"] : null; |
2563 | 2563 | $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; |
2564 | - $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
2564 | + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
2565 | 2565 | $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; |
2566 | 2566 | $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; |
2567 | 2567 | // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on |
@@ -2781,7 +2781,7 @@ discard block |
||
2781 | 2781 | $obj = $this->db->fetch_object($result); |
2782 | 2782 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
2783 | 2783 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
2784 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
2784 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
2785 | 2785 | } else { |
2786 | 2786 | $this->error = $this->db->error(); |
2787 | 2787 | $error++; |
@@ -4218,7 +4218,7 @@ discard block |
||
4218 | 4218 | //Addition of a product with the highest rank +1 |
4219 | 4219 | $sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)"; |
4220 | 4220 | $sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".price2num($incdec, 'MS').", ".((int) $rank).")"; |
4221 | - if (! $this->db->query($sql)) { |
|
4221 | + if (!$this->db->query($sql)) { |
|
4222 | 4222 | dol_print_error($this->db); |
4223 | 4223 | return -1; |
4224 | 4224 | } else { |
@@ -4301,17 +4301,17 @@ discard block |
||
4301 | 4301 | |
4302 | 4302 | // Updated ranks so that none are missing |
4303 | 4303 | $sqlrank = "SELECT rowid, rang FROM ".$this->db->prefix()."product_association"; |
4304 | - $sqlrank.= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
4305 | - $sqlrank.= " ORDER BY rang"; |
|
4304 | + $sqlrank .= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
4305 | + $sqlrank .= " ORDER BY rang"; |
|
4306 | 4306 | $resqlrank = $this->db->query($sqlrank); |
4307 | 4307 | if ($resqlrank) { |
4308 | 4308 | $cpt = 0; |
4309 | 4309 | while ($objrank = $this->db->fetch_object($resqlrank)) { |
4310 | 4310 | $cpt++; |
4311 | 4311 | $sql = "UPDATE ".$this->db->prefix()."product_association"; |
4312 | - $sql.= " SET rang = ".((int) $cpt); |
|
4313 | - $sql.= " WHERE rowid = ".((int) $objrank->rowid); |
|
4314 | - if (! $this->db->query($sql)) { |
|
4312 | + $sql .= " SET rang = ".((int) $cpt); |
|
4313 | + $sql .= " WHERE rowid = ".((int) $objrank->rowid); |
|
4314 | + if (!$this->db->query($sql)) { |
|
4315 | 4315 | dol_print_error($this->db); |
4316 | 4316 | return -1; |
4317 | 4317 | } |
@@ -4889,9 +4889,9 @@ discard block |
||
4889 | 4889 | $sql .= " WHERE p.rowid = pa.fk_product_fils"; |
4890 | 4890 | $sql .= " AND pa.fk_product_pere = ".((int) $id); |
4891 | 4891 | $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens |
4892 | - $sql.= " ORDER BY pa.rang"; |
|
4892 | + $sql .= " ORDER BY pa.rang"; |
|
4893 | 4893 | |
4894 | - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); |
|
4894 | + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ?implode(',', $parents) : $parents), LOG_DEBUG); |
|
4895 | 4895 | |
4896 | 4896 | if ($level == 1) { |
4897 | 4897 | $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly |
@@ -5256,7 +5256,7 @@ discard block |
||
5256 | 5256 | $labelStatus = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatch') : $langs->transnoentitiesnoconv('ProductStatusOnSerial')); |
5257 | 5257 | $labelStatusShort = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatchShort') : $langs->transnoentitiesnoconv('ProductStatusOnSerialShort')); |
5258 | 5258 | } |
5259 | - } elseif ( $type == 2 && $status == 2 ) { |
|
5259 | + } elseif ($type == 2 && $status == 2) { |
|
5260 | 5260 | $labelStatus = $langs->transnoentitiesnoconv('ProductStatusOnSerial'); |
5261 | 5261 | $labelStatusShort = $langs->transnoentitiesnoconv('ProductStatusOnSerialShort'); |
5262 | 5262 | } |
@@ -5463,7 +5463,7 @@ discard block |
||
5463 | 5463 | $sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")"; |
5464 | 5464 | } |
5465 | 5465 | |
5466 | - $sql .= " ORDER BY ps.reel ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; |
|
5466 | + $sql .= " ORDER BY ps.reel ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE) ? 'DESC' : 'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; |
|
5467 | 5467 | |
5468 | 5468 | dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); |
5469 | 5469 | $result = $this->db->query($sql); |
@@ -5544,7 +5544,7 @@ discard block |
||
5544 | 5544 | if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { |
5545 | 5545 | $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; |
5546 | 5546 | if (isset($includedraftpoforvirtual)) { |
5547 | - $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them |
|
5547 | + $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them |
|
5548 | 5548 | } |
5549 | 5549 | $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock); |
5550 | 5550 | if ($result < 0) { |
@@ -6249,7 +6249,7 @@ discard block |
||
6249 | 6249 | global $langs; |
6250 | 6250 | |
6251 | 6251 | if (empty($this->duration_value)) { |
6252 | - $this->errors[]='ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
6252 | + $this->errors[] = 'ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
6253 | 6253 | return -1; |
6254 | 6254 | } |
6255 | 6255 |
@@ -275,7 +275,7 @@ |
||
275 | 275 | } else { |
276 | 276 | $title = $langs->trans("BrowseBlockedLog"); |
277 | 277 | } |
278 | -$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; |
|
278 | +$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; |
|
279 | 279 | |
280 | 280 | llxHeader('', $title, $help_url); |
281 | 281 |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $block_static->loadTrackedEvents(); |
81 | 81 | |
82 | 82 | $title = $langs->trans("BlockedLogSetup"); |
83 | -$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; |
|
83 | +$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; |
|
84 | 84 | |
85 | 85 | llxHeader('', $title, $help_url); |
86 | 86 |