@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | 'skip_batch' => &$skip_batch, |
238 | 238 | 'id_product_batch' => &$id_product_batch |
239 | 239 | ); |
240 | - $reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
240 | + $reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
241 | 241 | |
242 | 242 | if ($reshook < 0) { |
243 | 243 | if (!empty($hookmanager->resPrint)) { |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | // Update stock quantity |
579 | 579 | if (!$error) { |
580 | 580 | if ($alreadyarecord > 0) { |
581 | - $sql = "UPDATE ".$this->db->prefix()."product_stock SET reel = " . ((float) $oldqtywarehouse + (float) $qty); |
|
581 | + $sql = "UPDATE ".$this->db->prefix()."product_stock SET reel = ".((float) $oldqtywarehouse + (float) $qty); |
|
582 | 582 | $sql .= " WHERE fk_entrepot = ".((int) $entrepot_id)." AND fk_product = ".((int) $fk_product); |
583 | 583 | } else { |
584 | 584 | $sql = "INSERT INTO ".$this->db->prefix()."product_stock"; |
@@ -726,8 +726,8 @@ discard block |
||
726 | 726 | $this->price = $obj->price; |
727 | 727 | $this->fk_user_author = $obj->fk_user_author; |
728 | 728 | $this->label = $obj->label; |
729 | - $this->fk_origin = $obj->origin_id; // For backward compatibility |
|
730 | - $this->origintype = $obj->origin_type; // For backward compatibility |
|
729 | + $this->fk_origin = $obj->origin_id; // For backward compatibility |
|
730 | + $this->origintype = $obj->origin_type; // For backward compatibility |
|
731 | 731 | $this->origin_id = $obj->origin_id; |
732 | 732 | $this->origin_type = $obj->origin_type; |
733 | 733 | $this->inventorycode = $obj->inventorycode; |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | } else { // product_batch record not found |
963 | 963 | $pdluo->fk_product_stock = $vfk_product_stock; |
964 | 964 | $pdluo->qty = $qty; |
965 | - $pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby']; // No more used. Now eatby date is store in table of lot, no more into prouct_batch table. |
|
966 | - $pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby']; // No more used. Now sellby date is store in table of lot, no more into prouct_batch table. |
|
965 | + $pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby']; // No more used. Now eatby date is store in table of lot, no more into prouct_batch table. |
|
966 | + $pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby']; // No more used. Now sellby date is store in table of lot, no more into prouct_batch table. |
|
967 | 967 | $pdluo->batch = $vbatchnumber; |
968 | 968 | |
969 | 969 | $result = $pdluo->create($user, 1); |
@@ -1160,8 +1160,8 @@ discard block |
||
1160 | 1160 | $label .= '<div width="100%">'; |
1161 | 1161 | $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id; |
1162 | 1162 | $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; |
1163 | - $qtylabel = (($this->qty > 0) ? '<span class="stockmovemententry">+' : '<span class="stockmovementexit">') . $this->qty . '</span>'; |
|
1164 | - $label .= '<br><b>'.$langs->trans('Qty').':</b> ' . $qtylabel; |
|
1163 | + $qtylabel = (($this->qty > 0) ? '<span class="stockmovemententry">+' : '<span class="stockmovementexit">').$this->qty.'</span>'; |
|
1164 | + $label .= '<br><b>'.$langs->trans('Qty').':</b> '.$qtylabel; |
|
1165 | 1165 | if ($this->batch) { |
1166 | 1166 | $label .= '<br><b>'.$langs->trans('Batch').':</b> '.$this->batch; |
1167 | 1167 | } |
@@ -1289,8 +1289,8 @@ discard block |
||
1289 | 1289 | $sql = "SELECT sum(pb.qty) as cpt"; |
1290 | 1290 | $sql .= " FROM ".$this->db->prefix()."product_batch as pb"; |
1291 | 1291 | $sql .= " INNER JOIN ".$this->db->prefix()."product_stock as ps ON ps.rowid = pb.fk_product_stock"; |
1292 | - $sql .= " WHERE ps.fk_product = " . ((int) $fk_product); |
|
1293 | - $sql .= " AND pb.batch = '" . $this->db->escape($batch) . "'"; |
|
1292 | + $sql .= " WHERE ps.fk_product = ".((int) $fk_product); |
|
1293 | + $sql .= " AND pb.batch = '".$this->db->escape($batch)."'"; |
|
1294 | 1294 | |
1295 | 1295 | $result = $this->db->query($sql); |
1296 | 1296 | if ($result) { |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | */ |
1315 | 1315 | public function reverseMouvement() |
1316 | 1316 | { |
1317 | - $formattedDate = "REVERTMV" .dol_print_date($this->datem, '%Y%m%d%His'); |
|
1317 | + $formattedDate = "REVERTMV".dol_print_date($this->datem, '%Y%m%d%His'); |
|
1318 | 1318 | if ($this->label == 'Annulation movement ID'.$this->id) { |
1319 | 1319 | return -1; |
1320 | 1320 | } |
@@ -1350,11 +1350,11 @@ discard block |
||
1350 | 1350 | { |
1351 | 1351 | $date = ''; |
1352 | 1352 | |
1353 | - $sql = "SELECT MAX(datem) as datem"; |
|
1353 | + $sql = "SELECT MAX(datem) as datem"; |
|
1354 | 1354 | $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement"; |
1355 | - $sql .= " WHERE fk_product = " . ((int) $fk_product); |
|
1356 | - $sql .= " AND fk_entrepot = " .((int) $fk_entrepot); |
|
1357 | - $sql .= " AND batch = '" . $this->db->escape($batch) . "'"; |
|
1355 | + $sql .= " WHERE fk_product = ".((int) $fk_product); |
|
1356 | + $sql .= " AND fk_entrepot = ".((int) $fk_entrepot); |
|
1357 | + $sql .= " AND batch = '".$this->db->escape($batch)."'"; |
|
1358 | 1358 | |
1359 | 1359 | $result = $this->db->query($sql); |
1360 | 1360 | if ($result) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | // Default sort order (if not yet defined by previous GETPOST) |
80 | 80 | if (!$sortfield) { |
81 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
81 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
82 | 82 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
83 | 83 | } |
84 | 84 | if (!$sortorder) { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | // Output page |
387 | 387 | // -------------------------------------------------------------------- |
388 | 388 | |
389 | -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-bookcal page-list_availabilities'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
389 | +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-bookcal page-list_availabilities'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
390 | 390 | |
391 | 391 | // Example : Adding jquery code |
392 | 392 | // print '<script type="text/javascript"> |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
520 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
520 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
521 | 521 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
522 | 522 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
523 | 523 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
612 | 612 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
613 | 613 | } |
614 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
614 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
615 | 615 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
616 | 616 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
617 | 617 | $totalarray['nbfield']++; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $object = new Calendar($db); |
67 | 67 | $extrafields = new ExtraFields($db); |
68 | 68 | $diroutputmassaction = $conf->bookcal->dir_output.'/temp/massgeneration/'.$user->id; |
69 | -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
69 | +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
70 | 70 | |
71 | 71 | // Fetch optionals attributes and labels |
72 | 72 | $extrafields->fetch_name_optionals_label($object->table_element); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | // Default sort order (if not yet defined by previous GETPOST) |
78 | 78 | if (!$sortfield) { |
79 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
79 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
80 | 80 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
81 | 81 | } |
82 | 82 | if (!$sortorder) { |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | // Output page |
383 | 383 | // -------------------------------------------------------------------- |
384 | 384 | |
385 | -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-bookcal page-list_calendar'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
385 | +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-bookcal page-list_calendar'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
386 | 386 | |
387 | 387 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
388 | 388 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | } |
500 | 500 | |
501 | 501 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
502 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
502 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
503 | 503 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
504 | 504 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
505 | 505 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
593 | 593 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
594 | 594 | } |
595 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
595 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
596 | 596 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
597 | 597 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
598 | 598 | $totalarray['nbfield']++; |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | 'd.code_departement' => 'List:c_departements:code_departement:code_departement:', 'c.code' => 'List:c_country:code:code:', |
223 | 223 | 'e.phone' => 'Text', 'e.fax' => 'Text', 'e.statut' => 'Text', 'pe.rowid' => 'List:entrepot:ref:rowid:stock', 'pe.ref' => 'Text' |
224 | 224 | ); |
225 | - $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon |
|
226 | - $this->export_aggregate_array[$r] = array(); // TODO Not used yet |
|
225 | + $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon |
|
226 | + $this->export_aggregate_array[$r] = array(); // TODO Not used yet |
|
227 | 227 | $keyforselect = 'warehouse'; |
228 | 228 | $keyforelement = 'warehouse'; |
229 | 229 | $keyforaliasextra = 'extra'; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product', |
271 | 271 | 'ps.reel' => 'stock', |
272 | 272 | 'p.seuil_stock_alerte' => 'product', 'p.barcode' => 'product', 'bt.libelle' => 'product', |
273 | - ); // We define here only fields that use another icon that the one defined into export_icon |
|
273 | + ); // We define here only fields that use another icon that the one defined into export_icon |
|
274 | 274 | if (isModEnabled('barcode')) { |
275 | 275 | $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); |
276 | 276 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | 'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product', 'lcpn.label'=>'product', |
330 | 330 | 'pb.rowid' => 'batch', 'pb.batch' => 'batch', 'pb.qty' => 'batch', 'none.dateLastMovement' => 'movement', |
331 | 331 | 'pl.eatby' => 'batch', 'pl.sellby' => 'batch' |
332 | - ); // We define here only fields that use another icon that the one defined into export_icon |
|
332 | + ); // We define here only fields that use another icon that the one defined into export_icon |
|
333 | 333 | $this->export_special_array[$r] = array( |
334 | 334 | 'none.dateLastMovement'=>array('rule'=>'compute', 'classfile'=>'/product/stock/class/mouvementstock.class.php', 'class'=>'MouvementStock', 'method'=>'getDateLastMovementProductBatch', 'method_params'=>['e_rowid', 'p_rowid', 'pb_batch']), |
335 | 335 | ); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | 'e.rowid' => 'warehouse', 'e.ref' => 'warehouse', 'e.description' => 'warehouse', 'e.lieu' => 'warehouse', 'e.address' => 'warehouse', 'e.zip' => 'warehouse', 'e.town' => 'warehouse', |
384 | 384 | 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", |
385 | 385 | 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product' |
386 | - ); // We define here only fields that use another icon that the one defined into export_icon |
|
386 | + ); // We define here only fields that use another icon that the one defined into export_icon |
|
387 | 387 | if (isModEnabled('productbatch')) { |
388 | 388 | $this->export_fields_array[$r]['sm.batch'] = 'Batch'; |
389 | 389 | $this->export_TypeFields_array[$r]['sm.batch'] = 'Text'; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | 'e.rowid' => 'warehouse', 'e.ref' => 'warehouse', 'e.description' => 'warehouse', 'e.lieu' => 'warehouse', 'e.address' => 'warehouse', 'e.zip' => 'warehouse', 'e.town' => 'warehouse', |
435 | 435 | 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", |
436 | 436 | 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product' |
437 | - ); // We define here only fields that use another icon that the one defined into export_icon |
|
437 | + ); // We define here only fields that use another icon that the one defined into export_icon |
|
438 | 438 | if (isModEnabled('productbatch')) { |
439 | 439 | $this->export_fields_array[$r]['id.batch'] = 'Batch'; |
440 | 440 | $this->export_TypeFields_array[$r]['id.batch'] = 'Text'; |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | |
585 | 585 | $duration = $obj->duree; |
586 | 586 | $event['location'] = ($obj->socname ? $obj->socname : ""); |
587 | - $event['summary'] = $obj->ref." - ". $obj->description; |
|
587 | + $event['summary'] = $obj->ref." - ".$obj->description; |
|
588 | 588 | if ($obj->ref_client) |
589 | - $event['summary'].= " (".$obj->ref_client.")"; |
|
589 | + $event['summary'] .= " (".$obj->ref_client.")"; |
|
590 | 590 | |
591 | 591 | $event['desc'] = $obj->description; |
592 | 592 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $event['desc'] .= " - ".$obj->ref_contract; |
598 | 598 | |
599 | 599 | if ($obj->note_public) |
600 | - $event['desc'].= " - ".$obj->note_public; |
|
600 | + $event['desc'] .= " - ".$obj->note_public; |
|
601 | 601 | |
602 | 602 | $event['startdate'] = $datestart; |
603 | 603 | $event['enddate'] = ''; // $dateend; // Not required with type 'journal' |
@@ -585,19 +585,23 @@ |
||
585 | 585 | $duration = $obj->duree; |
586 | 586 | $event['location'] = ($obj->socname ? $obj->socname : ""); |
587 | 587 | $event['summary'] = $obj->ref." - ". $obj->description; |
588 | - if ($obj->ref_client) |
|
589 | - $event['summary'].= " (".$obj->ref_client.")"; |
|
588 | + if ($obj->ref_client) { |
|
589 | + $event['summary'].= " (".$obj->ref_client.")"; |
|
590 | + } |
|
590 | 591 | |
591 | 592 | $event['desc'] = $obj->description; |
592 | 593 | |
593 | - if ($obj->ref_project) |
|
594 | - $event['desc'] .= " - ".$obj->ref_project; |
|
594 | + if ($obj->ref_project) { |
|
595 | + $event['desc'] .= " - ".$obj->ref_project; |
|
596 | + } |
|
595 | 597 | |
596 | - if ($obj->ref_contract) |
|
597 | - $event['desc'] .= " - ".$obj->ref_contract; |
|
598 | + if ($obj->ref_contract) { |
|
599 | + $event['desc'] .= " - ".$obj->ref_contract; |
|
600 | + } |
|
598 | 601 | |
599 | - if ($obj->note_public) |
|
600 | - $event['desc'].= " - ".$obj->note_public; |
|
602 | + if ($obj->note_public) { |
|
603 | + $event['desc'].= " - ".$obj->note_public; |
|
604 | + } |
|
601 | 605 | |
602 | 606 | $event['startdate'] = $datestart; |
603 | 607 | $event['enddate'] = ''; // $dateend; // Not required with type 'journal' |