diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index aefe642970a..6e5ed9de613 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3206,13 +3206,13 @@ if ($action == 'create') $thirdparty = $soc; $discount_type = 0; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin', 'alpha').'&originid='.GETPOST('originid', 'int')); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; } - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); // Date invoice print '
| '.$langs->trans("Mask").': | '; - $texte.= ''.$form->textwithpicto('', $tooltip, 1, 1).' | '; + $texte.= ''.$form->textwithpicto('', $tooltip, 1, 1).' | '; $texte.= ''; @@ -137,9 +137,9 @@ class mod_myobject_advanced extends ModeleNumRefMyObject return 0; } - $date = ($object->date_bom ? $object->date_bom : $object->date); + $date = $object->date; - $numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date); + $numFinal=get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', null, $date); return $numFinal; } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index 0da53adb55f..f9a786dfe55 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -18,11 +18,12 @@ */ /** - * \file htdocs/core/modules/bom/mod_bom_standard.php - * \ingroup bom + * \file htdocs/core/modules/mymodule/mod_myobject_standard.php + * \ingroup mymodule * \brief File of class to manage MyObject numbering rules standard */ -require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; +dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php'); + /** * Class to manage customer order numbering rules standard @@ -85,7 +86,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."bom"; + $sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -119,7 +120,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject // D'abord on recupere la valeur max $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."bom_bom"; + $sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -132,7 +133,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject } else { - dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG); + dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG); return -1; } @@ -143,7 +144,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s", $max+1); - dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num); + dol_syslog("mod_myobject_standard::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php index 4598a010287..5aa9642a898 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php @@ -23,10 +23,9 @@ */ /** - * \file htdocs/core/modules/bom/modules_bom.php - * \ingroup bom - * \brief File that contains parent class for boms models - * and parent class for boms numbering models + * \file htdocs/core/modules/mymodule/modules_myobject.php + * \ingroup mymodule + * \brief File that contains parent class for myobjects document models and parent class for myobjects numbering models */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; @@ -34,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir /** - * Parent class for boms models + * Parent class for documents models */ abstract class ModelePDFMyObject extends CommonDocGenerator { @@ -52,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator // phpcs:enable global $conf; - $type = 'bom'; + $type = 'mymodule_myobject'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -65,7 +64,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator /** - * Parent class to manage numbering of BOMs + * Parent class to manage numbering of MyObject */ abstract class ModeleNumRefMyObject { @@ -92,7 +91,7 @@ abstract class ModeleNumRefMyObject public function info() { global $langs; - $langs->load("mrp"); + $langs->load("mymodule@mymodule"); return $langs->trans("NoDescription"); } @@ -104,7 +103,7 @@ abstract class ModeleNumRefMyObject public function getExample() { global $langs; - $langs->load("mrp"); + $langs->load("mymodule@mymodule"); return $langs->trans("NoExample"); } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 415e7cc7f99..840e46c9c1c 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -182,25 +182,39 @@ if (empty($reshook)) } } - if (! $error) { - // Record consumption - $moline = new MoLine($db); - - $result = $moline->create($user); - if ($result <= 0) { + $idstockmove = 0; + if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) { + // Record stock movement + $id_product_batch = 0; + $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + if ($idstockmove < 0) { $error++; - setEventMessages($moline->error, $moline->errors, 'errors'); + setEventMessages($stockmove->error, $stockmove->errors, 'errors'); } } if (! $error) { - // Record stock movement - $id_product_batch = 0; - $result = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); - if ($result <= 0) { + $pos = 0; + // Record consumption + $moline = new MoLine($db); + $moline->fk_mo = $object->id; + $moline->position = $pos; + $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = GETPOST('idwarehouse-'.$line->id.'-'.$i); + $moline->qty = GETPOST('qty-'.$line->id.'-'.$i); + $moline->batch = GETPOST('batch-'.$line->id.'-'.$i); + $moline->role = 'consumed'; + $moline->fk_mrp_production = $line->id; + $moline->fk_stock_movement = $idstockmove; + $moline->fk_user_creat = $user->id; + + $resultmoline = $moline->create($user); + if ($resultmoline <= 0) { $error++; - setEventMessages($stockmove->error, $stockmove->errors, 'errors'); + setEventMessages($moline->error, $moline->errors, 'errors'); } + + $pos++; } $i++; @@ -230,25 +244,39 @@ if (empty($reshook)) } } - if (! $error) { - // Record production - $moline = new MoLine($db); - - $result = $moline->create($user); - if ($result <= 0) { + $idstockmove = 0; + if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) { + // Record stock movement + $id_product_batch = 0; + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), GETPOST('qtytoproduce-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + if ($idstockmove < 0) { $error++; - setEventMessages($moline->error, $moline->errors, 'errors'); + setEventMessages($stockmove->error, $stockmove->errors, 'errors'); } } if (! $error) { - // Record stock movement - $id_product_batch = 0; - $result = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); - if ($result <= 0) { + $pos = 0; + // Record production + $moline = new MoLine($db); + $moline->fk_mo = $object->id; + $moline->position = $pos; + $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i); + $moline->qty = GETPOST('qtytoproduce-'.$line->id.'-'.$i); + $moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i); + $moline->role = 'produced'; + $moline->fk_mrp_production = $line->id; + $moline->fk_stock_movement = $idstockmove; + $moline->fk_user_creat = $user->id; + + $resultmoline = $moline->create($user); + if ($resultmoline <= 0) { $error++; - setEventMessages($stockmove->error, $stockmove->errors, 'errors'); + setEventMessages($moline->error, $moline->errors, 'errors'); } + + $pos++; } $i++; @@ -261,9 +289,13 @@ if (empty($reshook)) $qtyremaintoconsume = 0; $qtyremaintoproduce = 0; if ($qtyremaintoconsume == 0 && $qtyremaintoproduce == 0) { - $object->setStatut($object::STATUS_INPROGRESS); + $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_MO_PRODUCED'); } else { - $object->setStatut($object::STATUS_PRODUCED); + $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); + } + if ($result <= 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -273,13 +305,11 @@ if (empty($reshook)) } else { $db->commit(); } - } } - /* * View */ @@ -498,12 +528,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'consumeandproduceall') { $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRefAndDate", $object->ref, dol_print_date(dol_now(), 'standard')); - $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); + //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref; print ' | |
| '.$langs->trans("Creditor"); @@ -910,8 +914,12 @@ if ($source == 'order') $amount = price2num($amount); } - $fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id; - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id; + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor @@ -1029,9 +1037,12 @@ if ($source == 'invoice') $amount = price2num($amount); } - $fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id; - //$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," "); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id; + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor @@ -1202,9 +1213,12 @@ if ($source == 'contractline') $amount = price2num($amount); } - $fulltag = 'COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); - //$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," "); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); $qty = 1; @@ -1367,8 +1381,12 @@ if ($source == 'membersubscription') $amount = price2num($amount); } - $fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor @@ -1531,8 +1549,12 @@ if ($source == 'donation') $amount = price2num($amount); } - $fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); - if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } + } $fulltag = dol_string_unaccent($fulltag); // Creditor diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 55a4f3813e9..c8c535a9038 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5173,9 +5173,17 @@ dd.dropdowndd ul li { /* ============================================================================== */ -/* JMobile */ +/* JMobile - Android */ /* ============================================================================== */ +.searchpage .tagtr .tagtd { + padding-bottom: 3px; +} +.searchpage .tagtr .tagtd .button { + background: unset; + border: unset; +} + li.ui-li-divider .ui-link { color: #FFF !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 604bc743f93..50c637be3c9 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5306,9 +5306,17 @@ dd.dropdowndd ul li { /* ============================================================================== */ -/* JMobile */ +/* JMobile - Android */ /* ============================================================================== */ +.searchpage .tagtr .tagtd { + padding-bottom: 3px; +} +.searchpage .tagtr .tagtd .button { + background: unset; + border: unset; +} + li.ui-li-divider .ui-link { color: #FFF !important; } |