From c8589970af00a70e7dcb51068a977cccc0e5f40c Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 19 Jan 2022 15:33:30 +0100 Subject: [PATCH 1/4] FIX : event created from contract not linked to object origin --- htdocs/contrat/agenda.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 94232aa6afd..c320b708ccb 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -244,6 +244,8 @@ if ($id > 0) { $newcardbutton = ''; if (!empty($conf->agenda->enabled)) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { + $backtopage = $_SERVER['PHP_SELF'].'?id='.$object->id; + $out = '&origin='.urlencode($object->element).'&originid='.$object->id.'&backtopage='.urlencode($backtopage); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } From db9a26f8d426bbd292e4df84eefaab40e21cf1e3 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 19 Jan 2022 15:35:09 +0100 Subject: [PATCH 2/4] FIX error urlencode --- htdocs/contrat/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index c320b708ccb..a291a9d8761 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -245,7 +245,7 @@ if ($id > 0) { if (!empty($conf->agenda->enabled)) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { $backtopage = $_SERVER['PHP_SELF'].'?id='.$object->id; - $out = '&origin='.urlencode($object->element).'&originid='.$object->id.'&backtopage='.urlencode($backtopage); + $out = '&origin='.$object->element.'&originid='.$object->id.'&backtopage='.urlencode($backtopage); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } From 115f022ae9bb332ef91bc4be6ca2c8db5c52312d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cserveny=2C=20Tam=C3=A1s?= Date: Thu, 20 Jan 2022 00:55:52 +0100 Subject: [PATCH 3/4] Check if the lines in create is type object (like supplier invoice) --- .../class/fournisseur.commande.class.php | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index fc89ee06caa..6def2a9faf4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1357,32 +1357,38 @@ class CommandeFournisseur extends CommonOrder if ($this->id) { $num = count($this->lines); - + // insert products details into database for ($i = 0; $i < $num; $i++) { - $this->special_code = $this->lines[$i]->special_code; // TODO : remove this in 9.0 and add special_code param to addline() + $line = $this->lines[$i]; + if (!is_object($line)) { + $line = (object) $line; + } + + $this->special_code = $line->special_code; // TODO : remove this in 9.0 and add special_code param to addline() + // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $result = $this->addline( - $this->lines[$i]->desc, - $this->lines[$i]->subprice, - $this->lines[$i]->qty, - $this->lines[$i]->tva_tx, - $this->lines[$i]->localtax1_tx, - $this->lines[$i]->localtax2_tx, - $this->lines[$i]->fk_product, + $line->desc, + $line->subprice, + $line->qty, + $line->tva_tx, + $line->localtax1_tx, + $line->localtax2_tx, + $line->fk_product, 0, - $this->lines[$i]->ref_fourn, // $this->lines[$i]->ref_fourn comes from field ref into table of lines. Value may ba a ref that does not exists anymore, so we first try with value of product - $this->lines[$i]->remise_percent, + $line->ref_fourn, // $line->ref_fourn comes from field ref into table of lines. Value may ba a ref that does not exists anymore, so we first try with value of product + $line->remise_percent, 'HT', 0, - $this->lines[$i]->product_type, - $this->lines[$i]->info_bits, + $line->product_type, + $line->info_bits, false, - $this->lines[$i]->date_start, - $this->lines[$i]->date_end, - $this->lines[$i]->array_options, - $this->lines[$i]->fk_unit + $line->date_start, + $line->date_end, + $line->array_options, + $line->fk_unit ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error From 400d28238c58de1929232560e198e452616c694f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 Jan 2022 00:09:52 +0000 Subject: [PATCH 4/4] Fixing style errors. --- htdocs/fourn/class/fournisseur.commande.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6def2a9faf4..b86834ee206 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1357,17 +1357,17 @@ class CommandeFournisseur extends CommonOrder if ($this->id) { $num = count($this->lines); - + // insert products details into database for ($i = 0; $i < $num; $i++) { - $line = $this->lines[$i]; - if (!is_object($line)) { + $line = $this->lines[$i]; + if (!is_object($line)) { $line = (object) $line; } - + $this->special_code = $line->special_code; // TODO : remove this in 9.0 and add special_code param to addline() - + // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $result = $this->addline( $line->desc,