From 4efe2a0e09f53d03ee1d7d3899e1430e7134842b Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 24 Aug 2021 08:20:40 +0200 Subject: [PATCH 01/52] FIX invoice fetch not found syslog debug level instead of error --- htdocs/compta/facture/class/facture.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ea41bd4842a..1d68747b1a5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1625,10 +1625,10 @@ class Facture extends CommonInvoice } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); + $resql = $this->db->query($sql); + if ($resql) { + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; $this->entity = $obj->entity; @@ -1730,14 +1730,17 @@ class Facture extends CommonInvoice $this->error = $this->db->error(); return -3; } + + $this->db->free($resql); + return 1; } else { - $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; - dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); + dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_DEBUG); return 0; } } else { - $this->error = $this->db->error(); + $this->error = $this->db->lasterror(); + dol_syslog(__METHOD__ . ' Error : ' . $this->error, LOG_ERR); return -1; } } From a4a44faa7ff9bb00d8bafcb6e3d4a2b5cc730565 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 24 Aug 2021 16:21:55 +0200 Subject: [PATCH 02/52] FIX change LOG_DEBUG with LOG_WARNING in syslog and remove sql error in syslog (already done) --- htdocs/compta/facture/class/facture.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1d68747b1a5..4e6e6827231 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1735,12 +1735,11 @@ class Facture extends CommonInvoice return 1; } else { - dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_DEBUG); + dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_WARNING); return 0; } } else { $this->error = $this->db->lasterror(); - dol_syslog(__METHOD__ . ' Error : ' . $this->error, LOG_ERR); return -1; } } From ba594b20e02707b0ea8cc0b588971062782c8c9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Aug 2021 16:36:27 +0200 Subject: [PATCH 03/52] Fix phpcs --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3072e791aae..4188ca9719b 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1647,7 +1647,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul } print ''; - if ($candelete || ($db->jdate($objp->dp) >= dol_now())) { // Test on date is to be able to delete a corrupted record with a date in future + if ($candelete || ($db->jdate($objp->dp) >= dol_now())) { // Test on date is to be able to delete a corrupted record with a date in future print 'id.'&lineid='.$objp->rowid.'">'; print img_delete(); print ''; From 29f98041e6edeabf14a95a1e3c255af93d72d1ef Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 25 Aug 2021 08:48:42 +0200 Subject: [PATCH 04/52] conditiion always wrong when on following link --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2a361f03c24..d462acd4ce7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1516,7 +1516,7 @@ if ($source == 'member' || $source == 'membersubscription') { $oldtypeid = $member->typeid; $newtypeid = (int) (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid); - if ($oldtypeid != $newtypeid && !empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE)) { + if (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE)) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $adht = new AdherentType($db); // Amount by member type From 701b43d9172fd2d264e2a33a620b2470ebb5bd52 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 25 Aug 2021 09:01:30 +0200 Subject: [PATCH 05/52] Add MEMBER_ALLOW_CHANGE_OF_TYPE in admin panel --- htdocs/adherents/admin/member.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index d03beec610e..5ff86a45e0e 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -225,6 +225,11 @@ print ''.$langs->trans("MemberCreateAnExternalUserForSub print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (!empty($conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN) ? $conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN : 0), 1); print "\n"; +// Allow members to change type on renewal forms +print ''.$langs->trans("MemberAllowchangeOfType").''; +print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1); +print "\n"; + // Insert subscription into bank account print ''.$langs->trans("MoreActionsOnSubscription").''; $arraychoices = array('0'=>$langs->trans("None")); From d022b3b0a1e0a1216df7dfda7df266a27e77c1b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Aug 2021 12:24:13 +0200 Subject: [PATCH 06/52] FIx #18481 --- htdocs/adherents/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b33e03d5855..32a324ce4d6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -2010,8 +2010,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Generated documents $filename = dol_sanitizeFileName($object->ref); //$filename = 'tmp_cards.php'; - //$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref); - $filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'member'); + $filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member'); $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; $genallowed = $user->rights->adherent->lire; $delallowed = $user->rights->adherent->creer; From 65629711d0722a96f5061b7b8e5dffa224cdb79b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Aug 2021 14:53:14 +0200 Subject: [PATCH 07/52] FIX #18484 --- htdocs/core/actions_massactions.inc.php | 40 +++--- htdocs/core/class/commonobject.class.php | 6 +- htdocs/langs/en_US/orders.lang | 1 + htdocs/reception/list.php | 157 +++++++++++++++-------- 4 files changed, 124 insertions(+), 80 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index cf412223838..c2538421bfe 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -631,6 +631,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $validate_invoices = GETPOST('validate_invoices', 'int'); + $errors = array(); + $TFact = array(); $TFactThird = array(); @@ -645,18 +647,19 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. if ($cmd->fetch($id_order) <= 0) { continue; } + $cmd->fetch_thirdparty(); $objecttmp = new Facture($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) { - $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. + // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it. + $objecttmp = $TFactThird[$cmd->socid]; } else { - // Load extrafields of order - $cmd->fetch_optionals(); - + // If we want one invoice per order or if there is no first invoice yet for this thirdparty. $objecttmp->socid = $cmd->socid; $objecttmp->type = $objecttmp::TYPE_STANDARD; - $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; - $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; + $objecttmp->cond_reglement_id = ($cmd->cond_reglement_id || $cmd->thirdparty->cond_reglement_id); + $objecttmp->mode_reglement_id = ($cmd->mode_reglement_id || $cmd->thirdparty->mode_reglement_id); + $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { @@ -680,23 +683,20 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $nb_bills_created++; $lastref = $objecttmp->ref; $lastid = $objecttmp->id; + + $TFactThird[$cmd->socid] = $objecttmp; + } else { + $langs->load("errors"); + $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->error); + $error++; } } if ($objecttmp->id > 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; - $sql .= "fk_source"; - $sql .= ", sourcetype"; - $sql .= ", fk_target"; - $sql .= ", targettype"; - $sql .= ") VALUES ("; - $sql .= $id_order; - $sql .= ", '".$db->escape($objecttmp->origin)."'"; - $sql .= ", ".$objecttmp->id; - $sql .= ", '".$db->escape($objecttmp->element)."'"; - $sql .= ")"; + $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order); - if (!$db->query($sql)) { + if ($res == 0) { + $errors[] = $objecttmp->error; $error++; } @@ -845,7 +845,6 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. } $id = $objecttmp->id; // For builddoc action - $object = $objecttmp; // Builddoc $donotredirect = 1; @@ -854,7 +853,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. // Call action to build doc $savobject = $object; - $object = $objecttmp; + $object = $objecttmp; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; $object = $savobject; } @@ -949,6 +948,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. exit; } else { $db->rollback(); + $action = 'create'; $_GET["origin"] = $_POST["origin"]; $_GET["originid"] = $_POST["originid"]; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1e28afd41e0..5df73f49f5c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3577,7 +3577,7 @@ abstract class CommonObject * @param string $origin Linked element type * @param int $origin_id Linked element id * @param User $f_user User that create - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @param int $notrigger 1=Does not execute triggers, 0=execute triggers * @return int <=0 if KO, >0 if OK * @see fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked() */ @@ -3611,9 +3611,9 @@ abstract class CommonObject $sql .= ", fk_target"; $sql .= ", targettype"; $sql .= ") VALUES ("; - $sql .= $origin_id; + $sql .= ((int) $origin_id); $sql .= ", '" . $this->db->escape($origin) . "'"; - $sql .= ", " . $this->id; + $sql .= ", " . ((int) $this->id); $sql .= ", '" . $this->db->escape($this->element) . "'"; $sql .= ")"; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 5dab5b99bf1..9018db40a5b 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -151,6 +151,7 @@ PDFEdisonDescription=A simple order model PDFProformaDescription=A complete Proforma invoice template CreateInvoiceForThisCustomer=Bill orders CreateInvoiceForThisSupplier=Bill orders +CreateInvoiceForThisReceptions=Bill receptions NoOrdersToInvoice=No orders billable CloseProcessedOrdersAutomatically=Classify "Processed" all selected orders. OrderCreation=Order creation diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index dd9f365c39a..e4b519517ea 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -171,87 +171,102 @@ if (empty($reshook)) { $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $validate_invoices = GETPOST('validate_invoices', 'int'); + $errors = array(); + $TFact = array(); $TFactThird = array(); $nb_bills_created = 0; + $lastid= 0; + $lastref = ''; $db->begin(); - $errors = array(); + foreach ($receptions as $id_reception) { $rcp = new Reception($db); - // On ne facture que les réceptions validées - if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1) { + // We only invoice reception that are validated + if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != $rcp::STATUS_VALIDATED) { $errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusSupplierOrderValidatedShort")); $error++; continue; } - $object = new FactureFournisseur($db); + $objecttmp = new FactureFournisseur($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) { - $object = $TFactThird[$rcp->socid]; // If option "one bill per third" is set, we use already created reception. - if (empty($object->rowid) && $object->id != null) { - $object->rowid = $object->id; - } - if (!empty($object->rowid)) { - $object->fetchObjectLinked(); - } - $rcp->fetchObjectLinked(); + // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it. + $objecttmp = $TFactThird[$rcp->socid]; - if (count($rcp->linkedObjectsIds['reception']) > 0) { - foreach ($rcp->linkedObjectsIds['reception'] as $key => $value) { - if (empty($object->linkedObjectsIds['reception']) || !in_array($value, $object->linkedObjectsIds['reception'])) { //Dont try to link if already linked - $object->add_object_linked('reception', $value); // add supplier order linked object + // Add all links of this new reception to the existing invoice + $objecttmp->fetchObjectLinked(); + $rcp->fetchObjectLinked(); + if (count($rcp->linkedObjectsIds['order_supplier']) > 0) { + foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) { + if (empty($objecttmp->linkedObjectsIds['order_supplier']) || !in_array($value, $objecttmp->linkedObjectsIds['order_supplier'])) { //Dont try to link if already linked + $objecttmp->add_object_linked('order_supplier', $value); // add supplier order linked object } } } } else { - $object->socid = $rcp->socid; - $object->type = FactureFournisseur::TYPE_STANDARD; - $object->cond_reglement_id = $rcp->thirdparty->cond_reglement_supplier_id; - $object->mode_reglement_id = $rcp->thirdparty->mode_reglement_supplier_id; - $object->fk_account = !empty($rcp->thirdparty->fk_account) ? $rcp->thirdparty->fk_account : 0; - $object->remise_percent = !empty($rcp->thirdparty->remise_percent) ? $rcp->thirdparty->remise_percent : 0; - $object->remise_absolue = !empty($rcp->thirdparty->remise_absolue) ? $rcp->thirdparty->remise_absolue : 0; + // If we want one invoice per reception or if there is no first invoice yet for this thirdparty. + $objecttmp->socid = $rcp->socid; + $objecttmp->type = $objecttmp::TYPE_STANDARD; + $objecttmp->cond_reglement_id = $rcp->cond_reglement_id || $rcp->thirdparty->cond_reglement_supplier_id; + $objecttmp->mode_reglement_id = $rcp->mode_reglement_id || $rcp->thirdparty->mode_reglement_supplier_id; - $object->fk_project = $rcp->fk_project; - $object->ref_supplier = $rcp->ref_supplier; + $objecttmp->fk_account = !empty($rcp->thirdparty->fk_account) ? $rcp->thirdparty->fk_account : 0; + $objecttmp->remise_percent = !empty($rcp->thirdparty->remise_percent) ? $rcp->thirdparty->remise_percent : 0; + $objecttmp->remise_absolue = !empty($rcp->thirdparty->remise_absolue) ? $rcp->thirdparty->remise_absolue : 0; - $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - if (empty($datefacture)) { - $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); + $objecttmp->fk_project = $rcp->fk_project; + //$objecttmp->multicurrency_code = $rcp->multicurrency_code; + if (empty($createbills_onebythird)) { + $objecttmp->ref_supplier = $rcp->ref; + } else { + // Set a unique value for the invoice for the n reception + $objecttmp->ref_supplier = $langs->trans("Reception").' '.dol_print_date(dol_now(), 'dayhourlog').'-'.$rcp->socid; } - $object->date = $datefacture; - $object->origin = 'reception'; - $object->origin_id = $id_reception; + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + if (empty($datefacture)) { + $datefacture = dol_now(); + } + $objecttmp->date = $datefacture; + $objecttmp->origin = 'reception'; + $objecttmp->origin_id = $id_reception; + + $objecttmp->array_options = $rcp->array_options; // Copy extrafields + + // Set $objecttmp->linked_objects with all links order_supplier existing on reception, so same links will be added to the generated supplier invoice $rcp->fetchObjectLinked(); - if (count($rcp->linkedObjectsIds['reception']) > 0) { - foreach ($rcp->linkedObjectsIds['reception'] as $key => $value) { - $object->linked_objects['reception'] = $value; + if (count($rcp->linkedObjectsIds['order_supplier']) > 0) { + foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) { + $objecttmp->linked_objects['order_supplier'] = $value; } } - $res = $object->create($user); - //var_dump($object->error);exit; + $res = $objecttmp->create($user); // This should create the supplier invoice + links into $objecttmp->linked_objects + add a link to ->origin_id + + //var_dump($objecttmp->error);exit; if ($res > 0) { $nb_bills_created++; - $object->id = $res; + $lastref = $objecttmp->ref; + $lastid = $objecttmp->id; + + $TFactThird[$rcp->socid] = $objecttmp; } else { - $errors[] = $rcp->ref.' : '.$langs->trans($object->error); + $langs->load("errors"); + $errors[] = $rcp->ref.' : '.$langs->trans($objecttmp->error); $error++; } } - if ($object->id > 0) { - if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) { //cause function create already add object linked for facturefournisseur - $res = $object->add_object_linked($object->origin, $id_reception); + if ($objecttmp->id > 0) { + $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception); - if ($res == 0) { - $errors[] = $object->error; - $error++; - } + if ($res == 0) { + $errors[] = $objecttmp->error; + $error++; } if (!$error) { @@ -266,10 +281,15 @@ if (empty($reshook)) { for ($i = 0; $i < $num; $i++) { $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); + // If we build one invoice for several reception, we must put the ref of reception on the invoice line + if (!empty($createbills_onebythird)) { + $desc = dol_concatdesc($desc, $langs->trans("Reception").' '.$rcp->ref.' - '.dol_print_date($rcp->date, 'day')); + } + if ($lines[$i]->subprice < 0) { // Negative line, we create a discount line $discount = new DiscountAbsolute($db); - $discount->fk_soc = $object->socid; + $discount->fk_soc = $objecttmp->socid; $discount->amount_ht = abs($lines[$i]->total_ht); $discount->amount_tva = abs($lines[$i]->total_tva); $discount->amount_ttc = abs($lines[$i]->total_ttc); @@ -278,7 +298,7 @@ if (empty($reshook)) { $discount->description = $desc; $discountid = $discount->create($user); if ($discountid > 0) { - $result = $object->insert_discount($discountid); + $result = $objecttmp->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); } else { setEventMessages($discount->error, $discount->errors, 'errors'); @@ -314,7 +334,16 @@ if (empty($reshook)) { if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } - $result = $object->addline( + + // Extrafields + if (method_exists($lines[$i], 'fetch_optionals')) { + $lines[$i]->fetch_optionals(); + $array_options = $lines[$i]->array_options; + } + + $objecttmp->context['createfromclone']; + + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, $lines[$i]->tva_tx, @@ -359,9 +388,9 @@ if (empty($reshook)) { //$rcp->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) { - $TFactThird[$rcp->socid] = $object; + $TFactThird[$rcp->socid] = $objecttmp; } else { - $TFact[$object->id] = $object; + $TFact[$objecttmp->id] = $objecttmp; } } @@ -371,21 +400,27 @@ if (empty($reshook)) { if (!$error && $validate_invoices) { $massaction = $action = 'builddoc'; - foreach ($TAllFact as &$object) { - $result = $object->validate($user); + foreach ($TAllFact as &$objecttmp) { + $result = $objecttmp->validate($user); if ($result <= 0) { $error++; - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); break; } - $id = $object->id; // For builddoc action + $id = $objecttmp->id; // For builddoc action + $object =$objecttmp; // Fac builddoc $donotredirect = 1; $upload_dir = $conf->fournisseur->facture->dir_output; $permissiontoadd = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); + + // Call action to build doc + $savobject = $object; + $object = $objecttmp; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $object = $savobject; } $massaction = $action = 'confirm_createbills'; @@ -393,9 +428,17 @@ if (empty($reshook)) { if (!$error) { $db->commit(); - setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + + if ($nb_bills_created == 1) { + $texttoshow = $langs->trans('BillXCreated', '{s1}'); + $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); + setEventMessages($texttoshow, null, 'mesgs'); + } else { + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); + } } else { $db->rollback(); + $action = 'create'; $_GET["origin"] = $_POST["origin"]; $_GET["originid"] = $_POST["originid"]; @@ -597,7 +640,7 @@ $arrayofmassactions = array( ); if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) { - $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier"); + $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisReceptions"); } if ($massaction == 'createbills') { $arrayofmassactions = array(); @@ -656,7 +699,7 @@ if ($massaction == 'createbills') { print '
'; print '
'; - print ' '; + print ' '; print ''; print '
'; print '
'; From a0c9cf2d8d0e9b374eb435350e30fe14bd53c9ea Mon Sep 17 00:00:00 2001 From: henrynopo Date: Thu, 26 Aug 2021 12:31:20 +0800 Subject: [PATCH 08/52] Update card.php --- htdocs/expedition/card.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 582b23aec45..c4ec3504383 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -717,6 +717,16 @@ if (empty($reshook)) { unset($_POST[$qty]); } } + } else { // both product batch and stock are not activated. + $qty = "qtyl".$line_id; + $line->id = $line_id; + $line->qty = GETPOST($qty, 'int'); + $line->entrepot_id = 0; + if ($line->update($user) < 0) { + setEventMessages($line->error, $line->errors, 'errors'); + $error++; + } + unset($_POST[$qty]); } } else { // Product no predefined @@ -2252,6 +2262,16 @@ if ($action == 'create') { print ''; print ''; } + } else { // both product batch and stock are not activated. + print ''; + print ''; + // Qty to ship or shipped + print ''; + // Warehouse source + print ''; + // Batch number managment + print ''; + print ''; } print ''; From 931f712c5fbe3bc2ef70d1ad5a1a7505939cbd9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Aug 2021 11:53:57 +0200 Subject: [PATCH 09/52] Fix import gender man/woman, not 0/1 + import of thirdparty for members --- htdocs/core/modules/modAdherent.class.php | 12 +++++++++++- htdocs/core/modules/modCategorie.class.php | 4 ++-- htdocs/core/modules/modUser.class.php | 2 +- htdocs/langs/en_US/bills.lang | 2 +- htdocs/langs/en_US/exports.lang | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 16ecbee8526..d620c6244b7 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -344,6 +344,9 @@ class modAdherent extends DolibarrModules 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status*", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription' ); + if (!empty($conf->societe->enabled)) { + $this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty"; + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); @@ -355,16 +358,23 @@ class modAdherent extends DolibarrModules } } // End add extra fields + $this->import_convertvalue_array[$r] = array(); + if (!empty($conf->societe->enabled)) { + $this->import_convertvalue_array[$r]['a.fk_soc'] = array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty'); + } $this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r] = array( 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility', 'a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type', 'a.morphy'=>'(phy|mor)', 'a.statut'=>'^[0|1]', 'a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r] = array( - 'a.civility'=>"MR", 'a.lastname'=>'Smith', 'a.firstname'=>'John', 'a.login'=>'jsmith', 'a.pass'=>'passofjsmith', 'a.fk_adherent_type'=>'1', + 'a.civility'=>"MR", 'a.lastname'=>'Smith', 'a.firstname'=>'John', 'a.gender'=>'man or woman', 'a.login'=>'jsmith', 'a.pass'=>'passofjsmith', 'a.fk_adherent_type'=>'1', 'a.morphy'=>'"mor" or "phy"', 'a.societe'=>'JS company', 'a.address'=>'21 jump street', 'a.zip'=>'55000', 'a.town'=>'New York', 'a.country'=>'1', 'a.email'=>'jsmith@example.com', 'a.birth'=>'1972-10-10', 'a.statut'=>"0 or 1", 'a.note_public'=>"This is a public comment on member", 'a.note_private'=>"This is private comment on member", 'a.datec'=>dol_print_date($now, '%Y-%m__%d'), 'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'), '%Y-%m-%d') ); + if (!empty($conf->societe->enabled)) { + $this->import_examplevalues_array[$r]['a.fk_soc'] = "rowid or name"; + } // Cronjobs $arraydate = dol_getdate(dol_now()); diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 4f97eed58f0..776c5c76681 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -501,7 +501,7 @@ class modCategorie extends DolibarrModules 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') ); - $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"rowid or label", 'cs.fk_soc'=>"rowid or ref"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"rowid or label", 'cs.fk_soc'=>"rowid or name"); } // 2 Customers @@ -522,7 +522,7 @@ class modCategorie extends DolibarrModules 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') ); - $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"rowid or label", 'cs.fk_soc'=>"rowid or ref"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"rowid or label", 'cs.fk_soc'=>"rowid or name"); } // 3 Members diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index 01303892435..e54ac7bd440 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -322,7 +322,7 @@ class modUser extends DolibarrModules 'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$' ); $this->import_examplevalues_array[$r] = array( - 'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1', 'u.job'=>'CTO', 'u.gender'=>'0 or 1', + 'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1', 'u.job'=>'CTO', 'u.gender'=>'man or woman', 'u.pass_crypted'=>'Encrypted password', 'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.datec'=>dol_print_date(dol_now(), '%Y-%m-%d'), 'u.address'=>"61 jump street", 'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102", diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 0c660de8e22..a835ec8475d 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -570,7 +570,7 @@ ToCreateARecurringInvoiceGene=To generate future invoices regularly and manually ToCreateARecurringInvoiceGeneAuto=If you need to have such invoices generated automatically, ask your administrator to enable and setup module %s. Note that both methods (manual and automatic) can be used together with no risk of duplication. DeleteRepeatableInvoice=Delete template invoice ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice? -CreateOneBillByThird=Create one invoice per third party (otherwise, one invoice per order) +CreateOneBillByThird=Create one invoice per third party (otherwise, one invoice per selected object) BillCreated=%s invoice(s) generated BillXCreated=Invoice %s generated StatusOfGeneratedDocuments=Status of document generation diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index cb652229825..f2f2d2cf587 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -96,8 +96,8 @@ DataComeFromFileFieldNb=Value to insert comes from field number %s in sou DataComeFromIdFoundFromRef=Value that comes from field number %s of source file will be used to find the id of the parent object to use (so the object %s that has the ref. from source file must exist in the database). DataComeFromIdFoundFromCodeId=Code that comes from field number %s of source file will be used to find the id of the parent object to use (so the code from source file must exist in the dictionary %s). Note that if you know the id, you can also use it in the source file instead of the code. Import should work in both cases. DataIsInsertedInto=Data coming from source file will be inserted into the following field: -DataIDSourceIsInsertedInto=The id of parent object was found using the data in the source file, will be inserted into the following field: -DataCodeIDSourceIsInsertedInto=The id of parent line found from code, will be inserted into following field: +DataIDSourceIsInsertedInto=The id of the parent object, that was found using the data in the source file, will be inserted into the following field: +DataCodeIDSourceIsInsertedInto=The id of the parent line, that was found from code, will be inserted into the following field: SourceRequired=Data value is mandatory SourceExample=Example of possible data value ExampleAnyRefFoundIntoElement=Any ref found for element %s From ac55a052b2198e0b31d6d7306d90b9ccb500afe6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Aug 2021 12:41:37 +0200 Subject: [PATCH 10/52] Fix warning abuot external users shown only if appropriate --- htdocs/user/perms.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 692b3dc08af..391682b2d6d 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -258,8 +258,8 @@ print '
'; if ($user->admin) { print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); } -// Show warning about external users -if (empty($user->socid)) { +// If edited user is an extern user, we show warning for external users +if (! empty($object->socid)) { print info_admin(showModulesExludedForExternal($modules))."\n"; } From c6c87cd8131962e93c5ffd24304c98c6b865103d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Aug 2021 21:35:31 +0200 Subject: [PATCH 11/52] Fix duplicated code and missing declaration --- htdocs/contrat/class/contrat.class.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 29d84c86c57..f364e82dd68 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -181,6 +181,13 @@ class Contrat extends CommonObject */ public $lines = array(); + public $nbofservices; + public $nbofserviceswait; + public $nbofservicesopened; + public $nbofservicesexpired; + //public $lower_planned_end_date; + //public $higher_planner_end_date; + /** * Maps ContratLigne IDs to $this->lines indexes * @var int[] @@ -429,7 +436,8 @@ class Contrat extends CommonObject foreach ($this->lines as $contratline) { // Close lines not already closed if ($contratline->statut != ContratLigne::STATUS_CLOSED) { - $contratline->date_cloture = $now; + $contratline->date_end_real = $now; + $contratline->date_cloture = $now; // For backward compatibility $contratline->fk_user_cloture = $user->id; $contratline->statut = ContratLigne::STATUS_CLOSED; $result = $contratline->close_line($user, $now, $comment, $notrigger); @@ -753,6 +761,7 @@ class Contrat extends CommonObject // phpcs:enable global $langs, $conf, $extrafields; + $this->nbofservices = 0; $this->nbofserviceswait = 0; $this->nbofservicesopened = 0; $this->nbofservicesexpired = 0; @@ -2642,10 +2651,23 @@ class ContratLigne extends CommonObjectLine public $date_end; // date end planned public $date_end_real; // date end real // For backward compatibility + /** + * @deprecated Use date_start + */ public $date_ouverture_prevue; // date start planned + /** + * @deprecated Use date_start_real + */ public $date_ouverture; // date start real + /** + * @deprecated Use date_end + */ public $date_fin_validite; // date end planned + /** + * @deprecated Use date_end_real + */ public $date_cloture; // date end real + public $tva_tx; public $localtax1_tx; public $localtax2_tx; @@ -3062,7 +3084,6 @@ class ContratLigne extends CommonObjectLine $this->oldcopy = new ContratLigne($this->db); $this->oldcopy->fetch($this->id); - $this->oldcopy->fetch_optionals(); // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; From ce7a301896320e321a2ba1caaf70fd320c742883 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 27 Aug 2021 11:48:56 +0200 Subject: [PATCH 12/52] Fix #18519 : Modulebuilder api permission --- .../modulebuilder/template/class/api_mymodule.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 2e04e34dcac..8b7718eac67 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -69,7 +69,7 @@ class MyModuleApi extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->mymodule->read) { + if (!DolibarrApiAccess::$user->rights->mymodule->myobject->read) { throw new RestException(401); } @@ -194,7 +194,7 @@ class MyModuleApi extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->mymodule->write) { + if (!DolibarrApiAccess::$user->rights->mymodule->myobject->write) { throw new RestException(401); } // Check mandatory fields @@ -222,7 +222,7 @@ class MyModuleApi extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->mymodule->write) { + if (!DolibarrApiAccess::$user->rights->mymodule->myobject->write) { throw new RestException(401); } @@ -260,7 +260,7 @@ class MyModuleApi extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->mymodule->delete) { + if (!DolibarrApiAccess::$user->rights->mymodule->myobject->delete) { throw new RestException(401); } $result = $this->myobject->fetch($id); From acf0386a9bbe84e1b774c71abfd915a0f113f4da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 03:14:48 +0200 Subject: [PATCH 13/52] Fix css --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index f4e076640c4..76789ebe6de 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1050,7 +1050,7 @@ class FormTicket } // Subject - print ''.$langs->trans('Subject').''; + print ''.$langs->trans('Subject').''; print 'ref.'] '.$langs->trans('TicketNewMessage').'" />'; print ''; From 64c4e25c0237e59bda595e9ff5ccc9cc32ceeffd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 05:24:53 +0200 Subject: [PATCH 14/52] Fix warning --- htdocs/comm/action/class/actioncomm.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d5a0c427352..6bfa9de9926 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -585,12 +585,15 @@ class ActionComm extends CommonObject //dol_syslog(var_export($this->userassigned, true)); $already_inserted = array(); foreach ($this->userassigned as $key => $val) { - if (!is_array($val)) { // For backward compatibility when val=id + // Common value with new behavior is to have $val = array('id'=>iduser, 'transparency'=>0|1) and $this->userassigned is an array of iduser => $val. + if (!is_array($val)) { // For backward compatibility when $val='id'. $val = array('id'=>$val); } if ($val['id'] > 0) { - if (!empty($already_inserted[$val['id']])) continue; + if (!empty($already_inserted[$val['id']])) { + continue; + } $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; $sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")"; @@ -612,7 +615,10 @@ class ActionComm extends CommonObject if (!empty($this->socpeopleassigned)) { $already_inserted = array(); foreach ($this->socpeopleassigned as $id => $val) { - if (!empty($already_inserted[$val['id']])) continue; + // Common value with new behavior is to have $val = iduser and $this->socpeopleassigned is an array of iduser => $val. + if (!empty($already_inserted[$id])) { + continue; + } $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; $sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)"; @@ -623,7 +629,7 @@ class ActionComm extends CommonObject dol_syslog('Error to process socpeopleassigned: ' . $this->db->lasterror(), LOG_ERR); $this->errors[] = $this->db->lasterror(); } else { - $already_inserted[$val['id']] = true; + $already_inserted[$id] = true; } } } From 700138815927ee1dfc7c1cbe7de7e246d2a4d368 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 05:38:12 +0200 Subject: [PATCH 15/52] Fix warning event late on tab Resources --- htdocs/resource/element_resource.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 83a8d58d410..4d0736c5f64 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -281,6 +281,8 @@ $form = new Form($db); $pagetitle = $langs->trans('ResourceElementPage'); llxHeader('', $pagetitle, ''); +$now = dol_now(); +$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; // Load available resource, declared by modules $ret = count($object->available_resources); From 1fec53e7f2e5a0c0cabaff64242d6d292b7e3954 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 13:36:47 +0200 Subject: [PATCH 16/52] Fix generate the phpunit file from modulebuilder --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index f8ca876eafc..be8e4481681 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -383,7 +383,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module)) { $modulename = ucfirst($module); // Force first letter in uppercase $objectname = $tabobj; - dol_mkdir($dirins.'/'.strtolower($module).'/class'); + dol_mkdir($dirins.'/'.strtolower($module).'/test/phpunit'); $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $srcfile = $srcdir.'/test/phpunit/MyObjectTest.php'; $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php'; From 20d0b0c56409f202a7210245f2dbc964dc07d9f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 13:56:59 +0200 Subject: [PATCH 17/52] Fix link in some tooltips --- htdocs/modulebuilder/index.php | 11 +++++++---- htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index be8e4481681..ed090618855 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2218,7 +2218,8 @@ if ($module == 'initmodule') { if ($action != 'editfile' || empty($file)) { print ''; - $htmlhelp = $langs->trans("DictionariesDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Dictionaries').''); + $htmlhelp = $langs->trans("DictionariesDefDescTooltip", '{s1}'); + $htmlhelp = str_replace('{s1}', ''.$langs->trans('Setup').' - '.$langs->trans('Dictionaries').'', $htmlhelp); print $form->textwithpicto($langs->trans("DictionariesDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'
'; print '
'; print '
'; @@ -3002,7 +3003,8 @@ if ($module == 'initmodule') { if ($action != 'editfile' || empty($file)) { print ''; - $htmlhelp = $langs->trans("MenusDefDescTooltip", ''.$langs->trans('Setup').' - '.$langs->trans('Menus').''); + $htmlhelp = $langs->trans("MenusDefDescTooltip", '{s1}'); + $htmlhelp = str_replace('{s1}', ''.$langs->trans('Setup').' - '.$langs->trans('Menus').'', $htmlhelp); print $form->textwithpicto($langs->trans("MenusDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'
'; print '
'; print '
'; @@ -3134,7 +3136,8 @@ if ($module == 'initmodule') { if ($action != 'editfile' || empty($file)) { print ''; - $htmlhelp = $langs->trans("PermissionsDefDescTooltip", ''.$langs->trans('DefaultPermissions').''); + $htmlhelp = $langs->trans("PermissionsDefDescTooltip", '{s1}'); + $htmlhelp = str_replace('{s1}', ''.$langs->trans('DefaultRights').'', $htmlhelp); print $form->textwithpicto($langs->trans("PermissionsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'
'; print '
'; print '
'; @@ -3601,7 +3604,7 @@ if ($module == 'initmodule') { $cronjobs = $moduleobj->cronjobs; if ($action != 'editfile' || empty($file)) { - print ''.str_replace('{s1}', ''.$langs->transnoentities('CronList').'', $langs->trans("CronJobDefDesc", '{s1}')).'
'; + print ''.str_replace('{s1}', ''.$langs->transnoentities('CronList').'', $langs->trans("CronJobDefDesc", '{s1}')).'
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 58e19d36a22..50490fa119f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -295,6 +295,10 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment { cursor: pointer; max-width: 350px; } +.nofocusvisible:focus-visible { + outline: none; +} + div.buttonpayment input:focus { color: #008; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ef7e69c0538..1a18bbf6882 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -473,6 +473,10 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment { white-space: normal; color: #888 !important; } +.nofocusvisible:focus-visible { + outline: none; +} + div.buttonpayment input { background-color: unset; border-bottom: unset; From 45515fa8b2ef3313409af55466902cb0a24e95e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 14:28:50 +0200 Subject: [PATCH 18/52] fix css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 50490fa119f..79977faac6a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -296,7 +296,7 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment { max-width: 350px; } .nofocusvisible:focus-visible { - outline: none; + outline: none; } div.buttonpayment input:focus { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1a18bbf6882..0d8851208f6 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -474,7 +474,7 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment { color: #888 !important; } .nofocusvisible:focus-visible { - outline: none; + outline: none; } div.buttonpayment input { From c509e3bc432b111f952e1ebeb826f785b8d4fa42 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 26 Aug 2021 10:32:29 +0200 Subject: [PATCH 19/52] FIx error 500 on restler api PHP 8.0 --- htdocs/ticket/class/api_tickets.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index e104d425bf4..f3a9c738aac 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -17,7 +17,7 @@ use Luracast\Restler\RestException; -require 'ticket.class.php'; +require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; From faf1d52d9190747648c5a6fcbff3cf31a1fcb2de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 16:32:22 +0200 Subject: [PATCH 20/52] Update card.php --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c4ec3504383..e020758fbbb 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -717,7 +717,7 @@ if (empty($reshook)) { unset($_POST[$qty]); } } - } else { // both product batch and stock are not activated. + } elsif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); From 2ddebc123ab8eb67f1561555532a6b42d73a1ebf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Aug 2021 14:32:44 +0000 Subject: [PATCH 21/52] Fixing style errors. --- htdocs/expedition/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e020758fbbb..e8455c906ef 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -717,15 +717,15 @@ if (empty($reshook)) { unset($_POST[$qty]); } } - } elsif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. + } elsif(empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); $line->entrepot_id = 0; - if ($line->update($user) < 0) { - setEventMessages($line->error, $line->errors, 'errors'); - $error++; - } + if ($line->update($user) < 0) { + setEventMessages($line->error, $line->errors, 'errors'); + $error++; + } unset($_POST[$qty]); } } else { From 31ca781236bcb96a0c9812d6a20787e1b2a4805c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 16:34:38 +0200 Subject: [PATCH 22/52] Update card.php --- htdocs/expedition/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e8455c906ef..8ab667780f0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -717,7 +717,7 @@ if (empty($reshook)) { unset($_POST[$qty]); } } - } elsif(empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. + } elseif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); @@ -2262,7 +2262,7 @@ if ($action == 'create') { print ''; print ''; } - } else { // both product batch and stock are not activated. + } elseif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. print ''; print ''; // Qty to ship or shipped From e60cf96c8eb669904c91e68fa845325c10832c80 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Aug 2021 14:35:01 +0000 Subject: [PATCH 23/52] Fixing style errors. --- htdocs/expedition/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8ab667780f0..d4ea2fa006c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -722,10 +722,10 @@ if (empty($reshook)) { $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); $line->entrepot_id = 0; - if ($line->update($user) < 0) { - setEventMessages($line->error, $line->errors, 'errors'); - $error++; - } + if ($line->update($user) < 0) { + setEventMessages($line->error, $line->errors, 'errors'); + $error++; + } unset($_POST[$qty]); } } else { From bb94ea73340b345d0abbe700ab41fd9f2f8c25ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 17:17:39 +0200 Subject: [PATCH 24/52] Fix debug car reception: Fill/reset link, colspan, translation --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/expedition/card.php | 34 +++++++++++++++--------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5df73f49f5c..cd7ea1af73c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7496,7 +7496,7 @@ abstract class CommonObject if ($display_type == 'card') { $out .= ''; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && $action == 'view') { + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'editline')) { $out .= ''; } $out .= 'transnoentitiesnoconv("QtyToShip").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $labelfieldmissing = $langs->transnoentitiesnoconv("QtyToShip"); + if (!empty($conf->stock->enabled)) { + $labelfieldmissing .= '/'.$langs->transnoentitiesnoconv("Warehouse"); + } + setEventMessages($langs->trans("ErrorFieldRequired", $labelfieldmissing), null, 'errors'); $error++; } @@ -796,6 +800,10 @@ $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expedic llxHeader('', $langs->trans('Shipment'), 'Expedition', $help_url); +if (empty($action)) { + $action = 'view'; +} + $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); @@ -1007,9 +1015,9 @@ if ($action == 'create') { $numAsked = count($object->lines); - print ''; + print 'return false; });'."\n"; + print 'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'."\n"; + print 'return false; });'."\n"; + print '});'."\n"; + print ''."\n"; print '
'; @@ -1182,7 +1191,7 @@ if ($action == 'create') { $deliverableQty = GETPOST('qtyl'.$indiceAsked, 'int'); } print ''; - print ''; + print ''; } else { print $langs->trans("NA"); } @@ -2199,7 +2208,7 @@ if ($action == 'create') { if ($action == 'editline' && $lines[$i]->id == $line_id) { // edit mode - print ''; + print ''; + + print ''; } print '
'; if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) { print ''; $line = new ExpeditionLigne($db); @@ -2389,10 +2398,11 @@ if ($action == 'create') { $line = $lines[$i]; $line->fetch_optionals(); + // TODO Show all in same line by setting $display_type = 'line' if ($action == 'editline' && $line->id == $line_id) { - print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked); + print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked, '', 0, 'card'); } else { - print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked); + print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked, '', 0, 'card'); } } } From 881d1769960c5075cd8f925caaa0d5619fa78c3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 17:30:53 +0200 Subject: [PATCH 25/52] css --- htdocs/core/tpl/contacts.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index d0d4d25740c..00a38fde351 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -90,7 +90,7 @@ if ($permission) { ?>
trans("ThirdParty"); ?>
-
trans("Users").' | '.$langs->trans("Contacts"); ?>
+
trans("Users"), 'user', 'class="optiongrey paddingright"').$langs->trans("Users").' | '.img_picto($langs->trans("Contacts"), 'contact', 'class="optiongrey paddingright"').$langs->trans("Contacts"); ?>
trans("ContactType"); ?>
 
 
From 4f45228e7bd87cedc6a6e40df5dece8ebc926270 Mon Sep 17 00:00:00 2001 From: LVSInformatique <34772354+plevray@users.noreply.github.com> Date: Wed, 25 Aug 2021 16:09:09 +0200 Subject: [PATCH 26/52] Update list.php --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0b363f560f3..15c5e47cc99 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -454,7 +454,7 @@ $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.tow $sql .= " s.entity,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; $sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; -$sql .= " s.tms as date_update, s.datec as date_creation,"; +$sql .= " s.tms as date_update, s.datec as date_creation, s.import_key,"; $sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,"; $sql .= " s2.nom as name2,"; $sql .= " typent.code as typent_code,"; From 978511e127d6b581cebf82417c96e7b092bb1808 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 17:55:49 +0200 Subject: [PATCH 27/52] Update fournisseur.facture.class.php Conflicts: htdocs/fourn/class/fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index abb5b01fb2c..69ddecdaebe 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3392,13 +3392,13 @@ class SupplierInvoiceLine extends CommonObjectLine if (empty($this->fk_product)) { $fk_product = "null"; } else { - $fk_product = $this->fk_product; + $fk_product = (int) $this->fk_product; } if (empty($this->fk_unit)) { $fk_unit = "null"; } else { - $fk_unit = "'".$this->db->escape($this->fk_unit)."'"; + $fk_unit = (int) $this->fk_unit; } $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; From 1c1caaccde992f7601fa13a23fcb430a46d0e588 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:21:23 +0200 Subject: [PATCH 28/52] Update member.php --- htdocs/adherents/admin/member.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 5ff86a45e0e..f9b10c3ce3b 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -226,9 +226,11 @@ print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (!empty($conf->g print "\n"; // Allow members to change type on renewal forms +/* To test during next beta print '
\n"; +*/ // Insert subscription into bank account print ''; From e71ff148ba8dc707335ea8f6497e52b6620b1ecb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:42:26 +0200 Subject: [PATCH 29/52] Fix phpcs --- htdocs/expedition/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3a626d56b03..8c959116582 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1016,8 +1016,8 @@ if ($action == 'create') { $numAsked = count($object->lines); print ''."\n"; + print 'return false; });'."\n"; + print '});'."\n"; + print ''."\n"; print '
'; From 8ab9c96b7e072b247e80a0c5e4d7a310599fdb33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:53:57 +0200 Subject: [PATCH 30/52] Fix 0 insert instead of null --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 69ddecdaebe..494459b66d2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3410,7 +3410,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", pu_ttc = ".price2num($this->pu_ttc); $sql .= ", qty = ".price2num($this->qty); $sql .= ", remise_percent = ".price2num($this->remise_percent); - if ($this->fk_remise_except) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); + if ($this->fk_remise_except > 0) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); else $sql .= ", fk_remise_except=null"; $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; $sql .= ", tva_tx = ".price2num($this->tva_tx); @@ -3423,7 +3423,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", total_localtax1= ".price2num($this->total_localtax1); $sql .= ", total_localtax2= ".price2num($this->total_localtax2); $sql .= ", total_ttc = ".price2num($this->total_ttc); - $sql .= ", fk_product = ".((int) $fk_product); + $sql .= ", fk_product = ".($fk_product > 0 ? (int) $fk_product : 'null'); $sql .= ", product_type = ".((int) $this->product_type); $sql .= ", info_bits = ".((int) $this->info_bits); $sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null'); From feb2e71f0c4cfe94dd5e1ed4e2de5546b3f8836a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 18:59:12 +0200 Subject: [PATCH 31/52] Fix regression --- htdocs/fourn/class/fournisseur.facture.class.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 494459b66d2..fd393445187 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3387,20 +3387,11 @@ class SupplierInvoiceLine extends CommonObjectLine $this->multicurrency_total_ttc = 0; } + $fk_product = (int) $this->fk_product; + $fk_unit = (int) $this->fk_unit; + $this->db->begin(); - if (empty($this->fk_product)) { - $fk_product = "null"; - } else { - $fk_product = (int) $this->fk_product; - } - - if (empty($this->fk_unit)) { - $fk_unit = "null"; - } else { - $fk_unit = (int) $this->fk_unit; - } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; $sql .= " description ='".$this->db->escape($this->description)."'"; $sql .= ", ref ='".$this->db->escape($this->ref_supplier ? $this->ref_supplier : $this->ref)."'"; From 81a8efd856acad862c1689780316a161b2645356 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Aug 2021 20:14:23 +0200 Subject: [PATCH 32/52] Restore error message --- htdocs/compta/facture/class/facture.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index deb57ebbfac..6859a510e93 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1735,7 +1735,9 @@ class Facture extends CommonInvoice return 1; } else { - dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_WARNING); + $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; + + dol_syslog(__METHOD__ . $this->error, LOG_WARNING); return 0; } } else { From daf32e9f141cbb82117b1435243c8daa55d5e09d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Aug 2021 20:36:08 +0200 Subject: [PATCH 33/52] Fix modules disabled in demo must remains disabled --- htdocs/admin/modules.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 77c070ad573..af7d5397e24 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -588,6 +588,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } + if (!empty($_SESSION["disablemodules"])) { + $disabled_modules = explode(',', $_SESSION["disablemodules"]); + } + // Show list of modules $oldfamily = ''; $foundoneexternalmodulewithupdate = 0; @@ -613,6 +617,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { continue; } + $modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); // Check filters @@ -754,6 +759,11 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codeenabledisable = ''; $codetoconfig = ''; + // Force disable of module disabled into session (for demo for example) + if (in_array($modulenameshort, $disabled_modules)) { + $objMod->disabled = true; + } + // Activate/Disable and Setup (2 columns) if (!empty($conf->global->$const_name)) { // If module is already activated // Set $codeenabledisable @@ -761,6 +771,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if (!empty($arrayofwarnings[$modName])) { $codeenabledisable .= ''."\n"; } + if (!empty($objMod->disabled)) { $codeenabledisable .= $langs->trans("Disabled"); } elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) { From 47b96e07b767205ca39702538d53f7ad673c159d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Aug 2021 20:36:54 +0200 Subject: [PATCH 34/52] Fix init --- htdocs/admin/modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index af7d5397e24..e746faec8a5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -760,6 +760,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codetoconfig = ''; // Force disable of module disabled into session (for demo for example) + $disabled_modules = array(); if (in_array($modulenameshort, $disabled_modules)) { $objMod->disabled = true; } From 74ad0586a903d4c59b2a89f62fe5ebb8c36d855d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Aug 2021 20:42:14 +0200 Subject: [PATCH 35/52] Fix disabled --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e746faec8a5..dd6b22f7634 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -588,6 +588,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } + $disabled_modules = array(); if (!empty($_SESSION["disablemodules"])) { $disabled_modules = explode(',', $_SESSION["disablemodules"]); } @@ -760,7 +761,6 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codetoconfig = ''; // Force disable of module disabled into session (for demo for example) - $disabled_modules = array(); if (in_array($modulenameshort, $disabled_modules)) { $objMod->disabled = true; } From 9c3ba22b025150ae28a5ae577e349ba45cea3bc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:38:31 +0200 Subject: [PATCH 36/52] Fix label of company of a thirdparty --- htdocs/adherents/list.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index f7c4d5e4d36..b700da148df 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -919,9 +919,13 @@ while ($i < min($num, $limit)) { if (!empty($obj->fk_soc)) { $memberstatic->fetch_thirdparty(); - $companyname = $memberstatic->thirdparty->name; + if ($memberstatic->thirdparty->id > 0) { + $companyname = $memberstatic->thirdparty->name; + $companynametoshow = $memberstatic->thirdparty->getNomUrl(1); + } } else { $companyname = $obj->company; + $companynametoshow = $obj->company; } $memberstatic->company = $companyname; @@ -984,7 +988,7 @@ while ($i < min($num, $limit)) { // Company if (!empty($arrayfields['d.company']['checked'])) { print '
\n"; } // Login From 9db5f85d4e9b5db027df383312cc35f9366e3cc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:42:41 +0200 Subject: [PATCH 37/52] Fix responsive --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b700da148df..d1af54d7168 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1098,7 +1098,7 @@ while ($i < min($num, $limit)) { } // EMail if (!empty($arrayfields['d.email']['checked'])) { - print "\n"; + print '\n"; } // End of subscription date $datefin = $db->jdate($obj->datefin); From b78771f8c4df90d955134ed20d14d65e67b0b04d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:56:52 +0200 Subject: [PATCH 38/52] Fix select empty value for thirdparties select combo --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4ff3dacb537..98807af1858 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1413,7 +1413,7 @@ class Form } } if ($showempty) { - $out .= ''."\n"; + $out .= ''."\n"; } $num = $this->db->num_rows($resql); From 3c029d0ccf2c9e4ae8875821fe2734c54db5ccd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 18:57:41 +0200 Subject: [PATCH 39/52] Fix sort on company on member list. --- htdocs/adherents/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d1af54d7168..ca62d0a4cc3 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -317,6 +317,7 @@ $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.p $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql .= " d.note_private, d.note_public,"; $sql .= " s.nom,"; +$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,"; $sql .= " t.libelle as type, t.subscription,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; // Add fields from extrafields @@ -832,7 +833,7 @@ if (!empty($arrayfields['d.gender']['checked'])) { print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder); } if (!empty($arrayfields['d.company']['checked'])) { - print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'companyname', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['d.login']['checked'])) { print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder); From 18e7a5efa960e0ccee8578cd43e563aa41c46bc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:00:15 +0200 Subject: [PATCH 40/52] Trans --- htdocs/langs/en_US/members.lang | 2 +- htdocs/langs/en_US/users.lang | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 2c4409caa88..b193e1f34b6 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -155,7 +155,7 @@ DescADHERENT_CARD_TEXT_RIGHT=Text printed on member cards (align on right) DescADHERENT_CARD_FOOTER_TEXT=Text printed on bottom of member cards ShowTypeCard=Show type '%s' HTPasswordExport=htpassword file generation -NoThirdPartyAssociatedToMember=No third party associated to this member +NoThirdPartyAssociatedToMember=No third party associated with this member MembersAndSubscriptions= Members and Subscriptions MoreActions=Complementary action on recording MoreActionsOnSubscription=Complementary action, suggested by default when recording a subscription diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 841ee0f3daf..888c9f52161 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -62,8 +62,8 @@ ListOfUsersInGroup=List of users in this group ListOfGroupsForUser=List of groups for this user LinkToCompanyContact=Link to third party / contact LinkedToDolibarrMember=Link to member -LinkedToDolibarrUser=Link to Dolibarr user -LinkedToDolibarrThirdParty=Link to Dolibarr third party +LinkedToDolibarrUser=Link to user +LinkedToDolibarrThirdParty=Link to third party CreateDolibarrLogin=Create a user CreateDolibarrThirdParty=Create a third party LoginAccountDisableInDolibarr=Account disabled in Dolibarr. From d1ef4bdbd18a3bcd2793dd36c90cae054050870d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:10:43 +0200 Subject: [PATCH 41/52] Fix missing login in tooltip --- htdocs/adherents/class/adherent.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2d5eae90938..df9e35651c2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2185,6 +2185,9 @@ class Adherent extends CommonObject if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; } + if (!empty($this->login)) { + $label .= '
'.$langs->trans('Login').': '.$this->login; + } if (!empty($this->firstname) || !empty($this->lastname)) { $label .= '
'.$langs->trans('Name').': '.$this->getFullName($langs); } From d9bfd72c29f7777f7b7fc4d9efdd8adfd58fe0b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:13:02 +0200 Subject: [PATCH 42/52] Fix missing login in tooltip --- htdocs/adherents/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ca62d0a4cc3..761a6502d0b 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -906,6 +906,7 @@ while ($i < min($num, $limit)) { $memberstatic->id = $obj->rowid; $memberstatic->ref = $obj->ref; $memberstatic->civility_id = $obj->civility; + $memberstatic->login = $obj->login; $memberstatic->lastname = $obj->lastname; $memberstatic->firstname = $obj->firstname; $memberstatic->gender = $obj->gender; From 7c9909ee120eee528b8c0f2e2464c2596eff9093 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:21:52 +0200 Subject: [PATCH 43/52] Fix label of list of members --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 761a6502d0b..61226097d5c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -492,7 +492,7 @@ if (GETPOSTISSET("search_status")) { if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } - if ($search_status == Adherent::STATUS_RESILIATED) { + if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is '' $titre = $langs->trans("MembersListResiliated"); } if ($search_status == Adherent::STATUS_EXCLUDED) { From 5549186e3a500180a91ed1806ab33cab782751ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:28:49 +0200 Subject: [PATCH 44/52] Fix link --- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 32a324ce4d6..3ac82b893a7 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1825,7 +1825,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Show link to invoices $tmparray = $company->getOutstandingBills('customer'); if (!empty($tmparray['refs'])) { - print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").': '.count($tmparray['refs']); + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; // TODO Add alert if warning on at least one invoice late print ''; } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 3a967677e17..4da534161d6 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -612,7 +612,7 @@ if ($rowid > 0) { // Show link to invoices $tmparray = $company->getOutstandingBills('customer'); if (!empty($tmparray['refs'])) { - print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").': '.count($tmparray['refs']); + print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')'; // TODO Add alert if warning on at least one invoice late print ''; } From 3e443e91464fd2dcd886901dade57a4aaba237c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 19:47:44 +0200 Subject: [PATCH 45/52] Fix partnership module --- htdocs/partnership/admin/setup.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 25567b137db..100dc7027a3 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -65,8 +65,10 @@ if ($action == 'setting') { $error += $partnership->delete_menus(); $error += $partnership->insert_menus(); - if (GETPOST("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", 'int')) + if (GETPOSTISSET("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL")) { dolibarr_set_const($db, "PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", GETPOST("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL", 'int'), 'chaine', 0, '', $conf->entity); + } + dolibarr_set_const($db, "PARTNERSHIP_BACKLINKS_TO_CHECK", GETPOST("PARTNERSHIP_BACKLINKS_TO_CHECK"), 'chaine', 0, '', $conf->entity); } @@ -131,16 +133,16 @@ print '
'; -if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { - print ''; - print ''; - print ''; - print ''; -} +//if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { +print ''; +print ''; +print ''; +print ''; +//} print '
'.$langs->trans("MemberAllowchangeOfType").''; print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1); print "
'.$langs->trans("MoreActionsOnSubscription").''; - print $companyname; + print $companynametoshow; print "".dol_print_email($obj->email, 0, 0, 1)."'.dol_print_email($obj->email, 0, 0, 1)."'.$langs->trans("partnershipforthirdparty print '
'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; - $dnbdays = '15'; - $backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; - print ''; - print ''.$dnbdays.'
'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; +$dnbdays = '30'; +$backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; +print ''; +print ''.$dnbdays.'
'; print ''; From 8639956b79b7124fab5708f559c978883569d9eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 21:22:00 +0200 Subject: [PATCH 46/52] Fix position of information on lines of documents --- htdocs/core/tpl/objectline_view.tpl.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3e8ef7ea411..b50ca83c6f6 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -79,6 +79,7 @@ if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && in_array($obje $sign = -1; } + $coldisplay = 0; ?> @@ -163,32 +164,33 @@ if (($line->info_bits & 2) == 2) { // Show date range if ($line->element == 'facturedetrec') { if ($line->date_start_fill || $line->date_end_fill) { - print '
'; + print '

'; } if ($line->date_start_fill) { - print $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); } if ($line->date_start_fill && $line->date_end_fill) { print ' - '; } if ($line->date_end_fill) { - print $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); } if ($line->date_start_fill || $line->date_end_fill) { print '
'; } } else { if ($line->date_start || $line->date_end) { - print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } //print get_date_range($line->date_start, $line->date_end, $format); } // Add description in form if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) { - print (!empty($line->description) && $line->description != $line->product_label) ? '
'.dol_htmlentitiesbr($line->description) : ''; + print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; } - //Line extrafield + + // Line extrafield if (!empty($extrafields)) { $temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); if (!empty($temps)) { From 426894f6a616f7e4f77f1697cad2632e9bab0611 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 21:44:09 +0200 Subject: [PATCH 47/52] Fix not null column --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 032504dfa61..d50b6991261 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -459,7 +459,7 @@ CREATE TABLE llx_partnership( fk_soc integer, fk_member integer, date_partnership_start date NOT NULL, - date_partnership_end date NOT NULL, + date_partnership_end date NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id, 0 = all reason_decline_or_cancel text NULL, date_creation datetime NOT NULL, From 60832c6e87b78d960cf9fe2a83aa20ae57c839dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 21:48:46 +0200 Subject: [PATCH 48/52] css --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f6a5ba93d61..161b0fb92bb 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1157,7 +1157,7 @@ class ExtraFields } else { $checked = ' value="1" '; } - $out = ''; + $out = ''; } else { $out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); } From b29fc5552d478bfe01c3b0761d63e63bf4d80033 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Aug 2021 22:10:26 +0200 Subject: [PATCH 49/52] Fix id in link --- htdocs/core/tpl/extrafields_view.tpl.php | 6 ++++-- htdocs/societe/partnership.php | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index e87d6df18dc..3f2ab773b06 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -199,11 +199,13 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) && $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $tmpkeyextra) && empty($extrafields->attributes[$object->table_element]['computed'][$tmpkeyextra])) { - $fieldid = 'id'; + $fieldid = empty($forcefieldid) ? 'id' : $forcefieldid; + $valueid = empty($forceobjectid) ? $object->id : $forceobjectid; if ($object->table_element == 'societe') { $fieldid = 'socid'; } - print '
'.img_edit().''.img_edit().'
'; print ''; diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index b1f0f24fbe1..a5393e500e3 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -245,7 +245,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $socid = $object->id; - // TODO Replace this card with the list of all partnerships. + // TODO Replace this card with a table of list of all partnerships. $object = new Partnership($db); $partnershipid = $object->fetch(0, '', 0, $socid); @@ -257,10 +257,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field - //unset($object->fields['fk_project']); // Hide field already shown in banner - //unset($object->fields['fk_member']); // Hide field already shown in banner + unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $forcefieldid = 'socid'; + $forceobjectid = $object->fk_soc; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; print ''; From bbf219fd7b64460593f725a640eef8ae98ab2b9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 13:09:52 +0200 Subject: [PATCH 50/52] FIX Export of website generates a package that contains a sql error --- htdocs/website/class/website.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 7e70bfddc6d..3872f9be6eb 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1091,8 +1091,8 @@ class Website extends CommonObject } } - $line .= "\n-- For Dolibarr v14+ --\n"; - $line .= "UPDATE llx_website SET fk_default_lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n"; + $line = "\n-- For Dolibarr v14+ --;\n"; + $line .= "UPDATE llx_website SET lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n"; $line .= "UPDATE llx_website SET otherlang = '".$this->db->escape($this->otherlang)."' WHERE rowid = __WEBSITE_ID__;\n"; $line .= "\n"; fputs($fp, $line); From c7444865a1e0d1a03e90fefaacac50049b4a4559 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 13:16:37 +0200 Subject: [PATCH 51/52] Fix css --- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 76789ebe6de..55f4aa9124d 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -263,7 +263,7 @@ class FormTicket require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 1fd3e062515..1d25249da75 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -212,7 +212,7 @@ if ($captcha) { - " class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> + " class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 8964145b430..6c6e2ca9dc3 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -150,7 +150,7 @@ if (!empty($captcha)) { - " class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> + " class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" /> From dad4c34ec5f80c1d16f16de2f779fad41c063c08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Aug 2021 23:51:45 +0200 Subject: [PATCH 52/52] Debug module conference or booth --- .../class/conferenceorbooth.class.php | 4 +- .../conferenceorbooth_list.php | 68 +++++++++++++------ htdocs/langs/en_US/eventorganization.lang | 7 +- htdocs/projet/card.php | 18 ++--- .../attendee_subscription.php | 20 +++--- htdocs/public/project/index.php | 2 +- 6 files changed, 75 insertions(+), 44 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index bb84bbe37bd..869a96e464e 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -242,11 +242,11 @@ class ConferenceOrBooth extends ActionComm */ public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '') { - global $dolibarr_main_url_root, $dolibarr_main_instance_unique_id, $conf, $langs; + global $dolibarr_main_url_root, $conf, $langs; $result = parent::fetch($id, $ref, $ref_ext, $email_msgid); - $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$id; + $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 9430d2c52ad..2306066f9a7 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -33,13 +33,13 @@ if ($conf->categorie->enabled) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } +global $dolibarr_main_url_root; + // for other modules //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "other")); - -global $dolibarr_main_url_root, $dolibarr_main_instance_unique_id; +$langs->loadLangs(array("eventorganization", "other", "projects")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) @@ -228,7 +228,7 @@ $now = dol_now(); //$help_url="EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth"; $help_url = ''; -$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("ConferenceOrBooths")); +$title = $langs->trans('ListOfConferencesOrBooths'); if ($projectid > 0) { $project = new Project($db); @@ -246,9 +246,9 @@ if ($projectid > 0) { } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; - $title = $langs->trans("Project") . ' - ' . $langs->trans("ConferenceOrBooths") . ' - ' . $project->ref . ' ' . $project->name; + $title = $langs->trans("Project") . ' - ' . $langs->trans("ListOfConferencesOrBooths") . ' - ' . $project->ref . ' ' . $project->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $project->name) { - $title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ConferenceOrBooths"); + $title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ListOfConferencesOrBooths"); } } @@ -352,14 +352,6 @@ if ($projectid > 0) { } print ''; - // Link to the vote/register page - print ''.$langs->trans("RegisterPage").''; - $linkregister = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id; - $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2); - $linkregister .= '&securekey='.urlencode($encodedsecurekey); - print ''.$linkregister.''; - print ''; - // Other attributes $cols = 2; $objectconf=$object; @@ -422,12 +414,45 @@ if ($projectid > 0) { $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // Show message - $message = 'entity > 1 ? "&entity=".$conf->entity : ""); $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); - $message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; + $message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; print $message; print ""; + // Link to the submit vote/register page + print ''; + //print ''; + print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage")); + //print ''; + print ''; + $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id; + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2); + $linksuggest .= '&securekey='.urlencode($encodedsecurekey); + //print ''; + //print ajax_autoselect("linkregister"); + print ''; + + // Link to the subscribe + print ''; + //print ''; + print $langs->trans("PublicAttendeeSubscriptionPage"); + //print ''; + print ''; + $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id; + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2); + $link_subscription .= '&securekey='.urlencode($encodedsecurekey); + //print ''; + //print ajax_autoselect("linkregister"); + print ''; print ''; @@ -437,7 +462,6 @@ if ($projectid > 0) { print '
'; - print dol_get_fiche_end(); } @@ -612,7 +636,7 @@ $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle' print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) -$topicmail = "SendConferenceOrBoothRef"; +$topicmail = $object->ref; $modelmail = "conferenceorbooth"; $objecttmp = new ConferenceOrBooth($db); $trackid = 'conferenceorbooth_'.$object->id; @@ -665,7 +689,7 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -713,7 +737,7 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -768,10 +792,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap left'; } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) { + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 67a242e640a..d2840be73f2 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -100,16 +100,17 @@ EvntOrgCancelled = Cancelled # Public page # SuggestForm = Suggestion page -RegisterPage = Page for conferences or booth +SuggestOrVoteForConfOrBooth = Page for suggestion or vote EvntOrgRegistrationHelpMessage = Here, you can vote for an event, or suggest a new conference or booth for the project EvntOrgRegistrationConfHelpMessage = Here, you can suggest a new conference for the project EvntOrgRegistrationBoothHelpMessage = Here, you can suggest a new booth for the project ListOfSuggestedConferences = List of suggested conferences ListOfSuggestedBooths = List of suggested booths +ListOfConferencesOrBooths=List of conferences or booths SuggestConference = Suggest a new conference SuggestBooth = Suggest a booth ViewAndVote = View and vote for suggested events -PublicAttendeeSubscriptionPage = Public link of registration to a conference +PublicAttendeeSubscriptionPage = Public link for registration to the event MissingOrBadSecureKey = The security key is invalid or missing EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference : '%s' EvntOrgDuration = This conference starts on %s and ends on %s. @@ -122,6 +123,8 @@ ConferenceIsNotConfirmed=Subcription not available, conference is not confirmed DateMustBeBeforeThan=%s must be before %s DateMustBeAfterThan=%s must be after %s +NewSubscription=Registration + # # Vote page # diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 4ee23fd632b..1a8cd850cbf 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -564,9 +564,9 @@ if ($action == 'create' && $user->rights->projet->creer) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print ' '; + print ' '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); - print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); + print ''; } print ''; print ''; @@ -830,7 +830,7 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print ''; print '