From b53f356638aae5f715e7c6c5cd72c20fe488c018 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2019 17:30:27 +0100 Subject: [PATCH 1/5] FIX #12760 #12763 #12755 #12765 #12751 --- htdocs/core/class/html.formmargin.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 345a94b3a62bd..6857eddf44a86 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -1,5 +1,5 @@ +/* Copyright (c) 2015-2019 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +98,7 @@ public function getMarginInfosArray($object, $force_price = false) $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign - if ($object->type == Facture::TYPE_SITUATION) { + if ($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht; From e5ddc8dfa3c4e35ba8fe62fb727ec914086b28eb Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 7 Jan 2020 09:43:13 +0100 Subject: [PATCH 2/5] Merge remote-tracking branch 'Dolibarr/11.0' into 11 --- htdocs/compta/facture/card.php | 8 +- htdocs/compta/stats/cabyuser.php | 38 +++++--- htdocs/core/class/commonobject.class.php | 3 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/search_page.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + .../template/class/myobject.class.php | 6 +- .../mymodule/mod_myobject_advanced.php | 16 ++-- .../mymodule/mod_myobject_standard.php | 15 +-- .../modules/mymodule/modules_myobject.php | 17 ++-- htdocs/mrp/mo_production.php | 91 +++++++++++++------ .../stock/class/mouvementstock.class.php | 2 +- htdocs/public/payment/newpayment.php | 48 +++++++--- htdocs/theme/eldy/global.inc.php | 10 +- htdocs/theme/md/style.css.php | 10 +- 15 files changed, 178 insertions(+), 91 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index aefe642970ad9..6e5ed9de61356 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3206,13 +3206,13 @@ $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('DateInvoice').''; @@ -3223,14 +3223,14 @@ if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { print ''.$langs->trans('DatePointOfTax').''; - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); print ''; } // Payment term print ''.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); + $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print ''; if (!empty($conf->global->INVOICE_USE_SITUATION)) diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 8d49711b121ce..fb9b06025aaf9 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -170,9 +170,11 @@ } elseif ($modecompta == "BOOKKEEPING") { + // TODO } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { + // TODO } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = ''.img_previous().' '.img_next().''; @@ -387,39 +389,53 @@ // Amount w/o VAT print ''; - if ($modecompta != 'CREANCES-DETTES') - { + if ($modecompta == 'RECETTES-DEPENSES') { if ($key > 0) { - print ''; + //print ''; } else { - print ''; + //print ''; } - } else { + } + elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { - print ''; + //print ''; } print price($amount_ht[$key]); + if ($key > 0) print ''; } print ''; // Amount with VAT print ''; - if ($modecompta != 'CREANCES-DETTES') { + if ($modecompta == 'RECETTES-DEPENSES') { if ($key > 0) { - print ''; + //print ''; } else { - print ''; + //print ''; } - } else { + } + elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { - print ''; + //print ''; } } print price($amount[$key]); + if ($modecompta == 'RECETTES-DEPENSES') { + if ($key > 0) { + //print ''; + } else { + //print ''; + } + } + elseif ($modecompta == 'CREANCES-DETTES') { + if ($key > 0) { + print ''; + } + } print ''; // Percent diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 498fa31431513..39548f3c41e5c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3522,6 +3522,7 @@ public function setStatut($status, $elementId = null, $elementType = '', $trigke if ($elementTable == 'user') $fieldstatus = "statut"; if ($elementTable == 'expensereport') $fieldstatus = "fk_statut"; if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus = "status"; + if (is_array($this->fields) && array_key_exists('status', $this->fields)) $fieldstatus = 'status'; $sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable; $sql .= " SET ".$fieldstatus." = ".$status; @@ -3572,7 +3573,7 @@ public function setStatut($status, $elementId = null, $elementType = '', $trigke else { $this->db->rollback(); - dol_syslog(get_class($this)."::setStatus ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 909d16d39e6e7..97409544a90fb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1567,7 +1567,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi { $accounted = $object->getVentilExportCompta(); $langs->load("accountancy"); - $morehtmlstatus .= '
'.($accounted > 0 ? $langs->trans("Accounted") : ''.$langs->trans("NotYetAccounted").''); + $morehtmlstatus .= '
'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")).''; } } diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 7ca287625eb10..194afb86d92cb 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -115,7 +115,7 @@ print "\n"; print '
'; print ''; -print '
'."\n"; +print '
'."\n"; print $searchform; print '
'."\n"; print '
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e4e7768128e5b..602cc65522e1d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1248,6 +1248,7 @@ AskForPreferredShippingMethod=Ask for preferred shipping method for Third Partie FieldEdition=Edition of field %s FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced) GetBarCode=Get barcode +NumberingModules=Numbering models ##### Module password generation PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. PasswordGenerationNone=Do not suggest a generated password. Password must be typed in manually. diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index d7a157c682f64..4859162abb082 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -584,8 +584,8 @@ public function validate($user, $notrigger = 0) // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); - $dirsource = $conf->myobject->dir_output.'/'.$oldref; - $dirdest = $conf->myobject->dir_output.'/'.$newref; + $dirsource = $conf->mymodule->dir_output.'/myobject/'.$oldref; + $dirdest = $conf->mymodule->dir_output.'/myobject/'.$newref; if (!$error && file_exists($dirsource)) { dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); @@ -594,7 +594,7 @@ public function validate($user, $notrigger = 0) { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles = dol_dir_list($conf->myobject->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); + $listoffiles = dol_dir_list($conf->mymodule->dir_output.'/myobject/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); foreach ($listoffiles as $fileentry) { $dirsource = $fileentry['name']; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index f9cc9d0b27cae..6a3a274f44369 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -21,12 +21,12 @@ */ /** - * \file htdocs/core/modules/bom/mod_bom_advanced.php - * \ingroup bom + * \file htdocs/core/modules/mymodule/mod_myobject_advanced.php + * \ingroup mymodule * \brief File containing class for advanced numbering model of MyObject */ -require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; +dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php'); /** @@ -71,15 +71,15 @@ public function info() $texte.= ''; $texte.= ''; - $tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Bom"), $langs->transnoentities("Bom")); + $tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject")); $tooltip.=$langs->trans("GenericMaskCodes2"); $tooltip.=$langs->trans("GenericMaskCodes3"); - $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Bom"), $langs->transnoentities("Bom")); + $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject")); $tooltip.=$langs->trans("GenericMaskCodes5"); // Parametrage du prefix $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; @@ -137,9 +137,9 @@ public function getNextValue($objprod, $object) 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 0da53adb55f4f..f9a786dfe5530 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 @@ public function canBeActivated() $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 @@ public function getNextValue($objprod, $object) // 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 @@ public function getNextValue($objprod, $object) } else { - dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG); + dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG); return -1; } @@ -143,7 +144,7 @@ public function getNextValue($objprod, $object) 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 4598a01028771..5aa9642a89881 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 @@ /** - * Parent class for boms models + * Parent class for documents models */ abstract class ModelePDFMyObject extends CommonDocGenerator { @@ -52,7 +51,7 @@ public static function liste_modeles($db, $maxfilenamelength = 0) // 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 @@ public static function liste_modeles($db, $maxfilenamelength = 0) /** - * Parent class to manage numbering of BOMs + * Parent class to manage numbering of MyObject */ abstract class ModeleNumRefMyObject { @@ -92,7 +91,7 @@ public function isEnabled() public function info() { global $langs; - $langs->load("mrp"); + $langs->load("mymodule@mymodule"); return $langs->trans("NoDescription"); } @@ -104,7 +103,7 @@ public function info() 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 415e7cc7f9912..840e46c9c1cba 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -182,25 +182,39 @@ } } - 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 (! $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 @@ $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 @@ } else { $db->commit(); } - } } - /* * View */ @@ -498,12 +528,13 @@ function init_myfunc() 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 '
'; print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; print $langs->trans("MovementLabel").':   '; - print $langs->trans("InventoryCode").':

'; + print $langs->trans("InventoryCode").':

'; print ' '.$langs->trans("AutoCloseMO").'
'; print ''; print '   '; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index a85b375b085ad..c50d816f14f4b 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -97,7 +97,7 @@ public function __construct($db) * @param int $entrepot_id Id of warehouse * @param int $qty Qty of movement (can be <0 or >0 depending on parameter type) * @param int $type Direction of movement: - * 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer), + * 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer), * 2=output (stock decrease), 3=input (stock increase) * Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2. * @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed. diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1357f9a86bb58..f91ec5e065349 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -843,7 +843,11 @@ { $found = true; $tag = GETPOST("tag", 'alpha'); - $fulltag = "TAG=".$tag; + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = "TAG=".$tag; + } // Creditor print '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Creditor"); @@ -910,8 +914,12 @@ $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 @@ $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 @@ $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 @@ $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 @@ $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 55a4f3813e9c0..c8c535a903804 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5173,9 +5173,17 @@ /* ============================================================================== */ -/* 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 604bc743f93a4..50c637be3c9ae 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5306,9 +5306,17 @@ /* ============================================================================== */ -/* 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; } From eb17a5202757d91d018b346bc6fe8b5d40c39dd6 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 5 Feb 2020 14:57:40 +0100 Subject: [PATCH 3/5] FIX 11.0 - default filtering for extrafields of type 'select' should not use a LIKE "%value%" condition because keys might overlap --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 29c6709497515..3a0bcf6375c3f 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -40,7 +40,10 @@ if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string - + elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { + $sql .= ' AND (' . $extrafieldsobjectprefix.$tmpkey . ' = "' . $db->escape($crit) . '")'; + continue; + } $sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search); } } From 0e65d08455e33bc146f5b3f03140292e62a9b221 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 7 Feb 2020 10:16:56 +0100 Subject: [PATCH 4/5] Fix set create_line rang parameter not required --- htdocs/expedition/class/expedition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a3f5f21659d31..bf20ac4261146 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -447,7 +447,7 @@ public function create($user, $notrigger = 0) * @param array $array_options extrafields array * @return int <0 if KO, line_id if OK */ - public function create_line($entrepot_id, $origin_line_id, $qty, $rang, $array_options = 0) + public function create_line($entrepot_id, $origin_line_id, $qty, $rang = 0, $array_options = 0) { //phpcs:enable global $user; From c083458adf871961e9af1c679dde9a6b959c4d57 Mon Sep 17 00:00:00 2001 From: pnueda Date: Fri, 7 Feb 2020 18:01:14 +0100 Subject: [PATCH 5/5] Update html.formfile.class.php Corrects a bug that adds a second '?' in the url string. When strpos returns 0 as the initial position for '?', it is (mis)taken as FALSE value, and then replaced by a second '?' in the list of get parameters, resulting in something like: /compta/facture/card.php?facid=397?action=remove_file... instead of /compta/facture/card.php?facid=397&action=remove_file... --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a3d73b627b716..7a3b48e1c402a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -859,7 +859,7 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, if ($delallowed) { $tmpurlsource = preg_replace('/#[a-zA-Z0-9_]*$/', '', $urlsource); - $out .= '