From bac413ff27503e232034233ae49a8bb006ce9177 Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 15 Dec 2023 16:19:05 +0100 Subject: [PATCH 1/9] Fix funnel of prospection display --- htdocs/core/boxes/box_funnel_of_prospection.php | 7 +++---- htdocs/core/class/dolgraph.class.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index 257f351cfca..63cb9b68257 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -102,6 +102,7 @@ class box_funnel_of_prospection extends ModeleBoxes $sql .= " FROM ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= " WHERE active=1"; $sql .= " AND cls.code <> 'LOST'"; + $sql .= " AND cls.code <> 'WON'"; $sql .= $this->db->order('cls.rowid', 'ASC'); $resql = $this->db->query($sql); if ($resql) { @@ -126,9 +127,6 @@ class box_funnel_of_prospection extends ModeleBoxes case 'NEGO': $colorseriesstat[$objp->rowid] = $badgeStatus4; break; - case 'WON': - $colorseriesstat[$objp->rowid] = $badgeStatus6; - break; default: break; } @@ -152,7 +150,7 @@ class box_funnel_of_prospection extends ModeleBoxes $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_opp_status = cls.rowid"; $sql .= " AND p.fk_statut = 1"; // Opend projects only - $sql .= " AND cls.code NOT IN ('LOST')"; + $sql .= " AND cls.code NOT IN ('LOST', 'WON')"; $sql .= " GROUP BY p.fk_opp_status, cls.code"; $resql = $this->db->query($sql); @@ -236,6 +234,7 @@ class box_funnel_of_prospection extends ModeleBoxes $dolgraph->setShowPercent(1); $dolgraph->setMirrorGraphValues(true); $dolgraph->setBorderWidth(2); + $dolgraph->setBorderSkip('false'); $dolgraph->SetType(array('horizontalbars')); $dolgraph->SetHeight('200'); $dolgraph->SetWidth('600'); diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 295b6c3f262..8a661d70982 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -94,6 +94,7 @@ class DolGraph public $bgcolorgrid = array(255, 255, 255); // array(R,G,B) public $datacolor; // array(array(R,G,B),...) public $borderwidth = 1; + public $borderskip = 'start'; private $stringtoshow; // To store string to output graph into HTML page @@ -311,6 +312,18 @@ class DolGraph $this->borderwidth = $borderwidth; } + /** + * Set border skip + * + * @param int $borderskip Can be 'start' to skip start border, 'end' to skip end border, 'middle' to skip middle border, + * 'false' to not skip any border, 'true' to skip all border + * @return void + */ + public function setBorderSkip($borderskip) + { + $this->borderskip = $borderskip; + } + /** * Set tooltips labels of the graph * @@ -1483,6 +1496,7 @@ class DolGraph $this->stringtoshow .= 'borderWidth: \''.$this->borderwidth.'\', '; } $this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', '; + $this->stringtoshow .= 'borderSkipped: \'' . $this->borderskip . '\', '; $this->stringtoshow .= 'backgroundColor: \'' . $color . '\', '; if (!empty($arrayofgroupslegend) && !empty($arrayofgroupslegend[$i])) { $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', '; From 286631629e6f7fcaf4cde64e9588edfa05db6506 Mon Sep 17 00:00:00 2001 From: jyhere Date: Fri, 15 Dec 2023 18:27:37 +0100 Subject: [PATCH 2/9] FIX: product association clone --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bbec24b64de..bcdd89b806b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4788,8 +4788,8 @@ class Product extends CommonObject // phpcs:enable $this->db->begin(); - $sql = 'INSERT INTO '.$this->db->prefix().'product_association (fk_product_pere, fk_product_fils, qty)'; - $sql .= " SELECT ".$toId.", fk_product_fils, qty FROM ".$this->db->prefix()."product_association"; + $sql = 'INSERT INTO '.$this->db->prefix().'product_association (fk_product_pere, fk_product_fils, qty, incdec)'; + $sql .= " SELECT ".$toId.", fk_product_fils, qty, incdec FROM ".$this->db->prefix()."product_association"; $sql .= " WHERE fk_product_pere = ".((int) $fromId); dol_syslog(get_class($this).'::clone_association', LOG_DEBUG); From e9aa68e3facbc20ea36aeb12e7c38b4ef0d68279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Dec 2023 20:36:10 +0100 Subject: [PATCH 3/9] fix phpdoc --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ef31fb50485..e65226b13d1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -167,8 +167,9 @@ abstract class CommonObject * @var CommonObject To store a cloned copy of object before to edit it and keep track of old properties */ public $oldcopy; + /** - * @var CommonObject To store old value of a modified ref + * @var string To store old value of a modified ref */ public $oldref; From 565a9eb191b2aa0758de0bf2db56c6fb747fd71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Dec 2023 22:31:32 +0100 Subject: [PATCH 4/9] fix initAsSpecimen values --- htdocs/website/class/websitepage.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index fd7a217c30e..9b4fe24dbc3 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -868,7 +868,7 @@ class WebsitePage extends CommonObject $now = dol_now(); - $this->fk_website = ''; + $this->fk_website = 0; $this->type_container = 'page'; $this->pageurl = 'specimen'; $this->aliasalt = 'specimenalt'; @@ -879,7 +879,7 @@ class WebsitePage extends CommonObject $this->allowed_in_frames = 1; $this->htmlheader = ''; $this->content = 'This is a html content'; - $this->status = ''; + $this->status = self::STATUS_DRAFT; $this->grabbed_from = ''; $this->date_creation = $now - (24 * 30 * 3600); $this->date_modification = $now - (24 * 7 * 3600); From 7099cf530f1b10971cb181eb7d0d727a0c16b4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Dec 2023 22:47:00 +0100 Subject: [PATCH 5/9] fix return value --- htdocs/user/class/userbankaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 9a43479e2da..7718d1abccc 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -315,7 +315,7 @@ class UserBankAccount extends Account $country_code_in_EEC = getCountriesInEEC(); return in_array($this->country_code, $country_code_in_EEC); } else { - return -1; + return false; } } } From f11dc69bea90510d4ab124c487acc1fff5b3b156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Dec 2023 22:50:02 +0100 Subject: [PATCH 6/9] fix set values --- htdocs/user/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 05826f80dbc..78e4e5e0ac4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -266,12 +266,12 @@ if (empty($reshook)) { $object->login = GETPOST("login", 'alphanohtml'); $object->api_key = GETPOST("api_key", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); - $object->admin = GETPOST("admin", 'int'); + $object->admin = GETPOSTINT("admin"); $object->address = GETPOST('address', 'alphanohtml'); $object->zip = GETPOST('zipcode', 'alphanohtml'); $object->town = GETPOST('town', 'alphanohtml'); - $object->country_id = GETPOST('country_id', 'int'); - $object->state_id = GETPOST('state_id', 'int'); + $object->country_id = GETPOSTINT('country_id'); + $object->state_id = GETPOSTINT('state_id'); $object->office_phone = GETPOST("office_phone", 'alphanohtml'); $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); @@ -314,7 +314,7 @@ if (empty($reshook)) { $object->dateendvalidity = $dateendvalidity; $object->birth = $dateofbirth; - $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); + $object->fk_warehouse = GETPOSTINT('fk_warehouse'); $object->lang = GETPOST('default_lang', 'aZ09'); From 86a4ae923691d9abcdfe3dd94433a6903a4a4077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Dec 2023 22:54:40 +0100 Subject: [PATCH 7/9] add phpdoc in subclass --- htdocs/user/class/user.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 16a1eeddcfc..251e06f6390 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -81,6 +81,11 @@ class User extends CommonObject public $id = 0; + /** + * @var User old copy of User + */ + public $oldcopy; + /** * @var int * @deprecated From 64b7f55825adb57c120c13db6afad811bc098e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Dec 2023 23:59:39 +0100 Subject: [PATCH 8/9] fix phpdoc --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index cacfa0f4495..df61da90875 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1584,7 +1584,7 @@ function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = '', $noprin * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket... to list events linked to an object * @param Contact $objcon Filter on object contact to filter events on a contact * @param int $noprint Return string but does not output it - * @param string $actioncode Filter on actioncode + * @param string|string[] $actioncode Filter on actioncode * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all). * @param array $filters Filter on other fields * @param string $sortfield Sort field From 188bf6f95930a07e569313dd3099cf9e1037b4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 16 Dec 2023 00:13:56 +0100 Subject: [PATCH 9/9] fix when actioncode is array --- htdocs/core/lib/company.lib.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index df61da90875..9b03b1d04e0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1810,13 +1810,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= ' AND ('; foreach ($actioncode as $key => $code) { if ($key != 0) { - $sql .= "OR ("; + $sql .= " OR "; } if (!empty($code)) { - addEventTypeSQL($sql, $code); - } - if ($key != 0) { - $sql .= ")"; + addEventTypeSQL($sql, $code, ""); } } $sql .= ')';