From b85ed3e0b7aaff32ca892235b293cbbfb8c7ad89 Mon Sep 17 00:00:00 2001 From: ATM-Marc Date: Sat, 18 May 2019 00:11:15 +0200 Subject: [PATCH 01/12] FIX: mail presend: can overwrite a file previously uploaded --- htdocs/core/actions_sendmails.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 539306f3cb3..17f1a70d555 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -43,7 +43,7 @@ if (GETPOST('addfile','alpha')) $vardir=$conf->user->dir_output."/".$user->id; $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid); + dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid); $action='presend'; } From 28a4785b3a85e3b3516b47988f03190dfa90a5ea Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 16:39:58 +0200 Subject: [PATCH 02/12] Fix missing TOKEN --- htdocs/holiday/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index af6772828dc..9f3d17aea63 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -876,6 +876,7 @@ if ((empty($id) && empty($ref)) || $action == 'add' || $action == 'request' || $ // Formulaire de demande print '
'."\n"; + print ''."\n"; print ''."\n"; if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) From ea1efa5e88462240a3d1100c1293a77c2d696966 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 16:40:14 +0200 Subject: [PATCH 03/12] Fix missing dashboard stats for holidays --- htdocs/holiday/class/holiday.class.php | 87 ++++++++++++++++++++++++++ htdocs/index.php | 18 +++++- 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 84156b75e32..84d0d7ae1ed 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2177,4 +2177,91 @@ class Holiday extends CommonObject $this->fk_type=1; $this->statut=Holiday::STATUS_VALIDATED; } + + /** + * Load this->nb for dashboard + * + * @return int <0 if KO, >0 if OK + */ + public function load_state_board() + { + global $conf; + + $this->nb=array(); + + $sql = "SELECT count(h.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as h"; + $sql.= " WHERE h.statut > 1"; + $sql.= " AND h.entity IN (".getEntity('holiday').")"; + + $resql=$this->db->query($sql); + if ($resql) { + while ($obj=$this->db->fetch_object($resql)) { + $this->nb["holidays"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @param User $user Objet user + * @param string $option 'toapprove' + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK + */ + public function load_board($user) + { + // phpcs:enable + global $conf, $langs; + + if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + + $now=dol_now(); + + $userchildids = $user->getAllChildIds(1); + + $sql = "SELECT h.rowid, h.date_debut"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as h"; + $sql.= " WHERE h.statut = 2"; + $sql.= " AND h.entity IN (".getEntity('holiday').")"; + $sql.= " AND (h.fk_user IN (".join(',', $userchildids).")"; + $sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))"; + + $resql=$this->db->query($sql); + if ($resql) + { + $langs->load("members"); + + $response = new WorkboardResponse(); + $response->warning_delay=$conf->holiday->approve->warning_delay/60/60/24; + $response->label=$langs->trans("HolidaysToApprove"); + $response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&leftmenu=hrm'; + $response->img=img_object('', "holiday"); + + while ($obj=$this->db->fetch_object($resql)) + { + $response->nbtodo++; + + if ($this->db->jdate($obj->date_debut) < ($now - $conf->holiday->approve->warning_delay)) { + $response->nbtodolate++; + } + } + + return $response; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } } diff --git a/htdocs/index.php b/htdocs/index.php index 81503139d88..ca3d22afd85 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -150,6 +150,7 @@ if (empty($user->societe_id)) ! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), ! empty($conf->projet->enabled) && $user->rights->projet->lire, ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + ! empty($conf->holiday->enabled) && $user->rights->holiday->read, ! empty($conf->don->enabled) && $user->rights->don->lire ); // Class file containing the method load_state_board for each line @@ -172,6 +173,7 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", DOL_DOCUMENT_ROOT."/projet/class/project.class.php", DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", DOL_DOCUMENT_ROOT."/don/class/don.class.php" ); // Name class containing the method load_state_board for each line @@ -193,6 +195,7 @@ if (empty($user->societe_id)) 'SupplierProposal', 'Project', 'ExpenseReport', + 'Holiday', 'Don' ); // Cle array returned by the method load_state_board for each line @@ -203,7 +206,7 @@ if (empty($user->societe_id)) 'contacts', 'members', 'products', - 'services', + 'services', 'proposals', 'orders', 'invoices', @@ -214,6 +217,7 @@ if (empty($user->societe_id)) 'askprice', 'projects', 'expensereports', + 'holidays', 'donations' ); // Dashboard Icon lines @@ -235,6 +239,7 @@ if (empty($user->societe_id)) 'propal', 'projectpub', 'trip', + 'holiday', 'generic' ); // Translation keyword @@ -256,6 +261,7 @@ if (empty($user->societe_id)) "SupplierProposalShort", "Projects", "ExpenseReports", + "Holidays", "Donations" ); // Dashboard Link lines @@ -278,6 +284,7 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=', DOL_URL_ROOT.'/projet/list.php?mainmenu=project', DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', + DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', DOL_URL_ROOT.'/don/list.php?leftmenu=donations' ); // Translation lang files @@ -299,6 +306,7 @@ if (empty($user->societe_id)) "supplier_proposal", "projects", "trips", + "holidays", "donations" ); @@ -496,6 +504,14 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_p $dashboardlines[] = $board->load_board($user,'topay'); } +// Number of holidays to approve +if (! empty($conf->holiday->enabled) && $user->rights->holiday->approve) +{ + include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; + $board=new Holiday($db); + $dashboardlines[] = $board->load_board($user); +} + $object=new stdClass(); $parameters=array(); $action=''; From 6c195d7bdf1481f28c96184dd21dc232514972b8 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 16:54:40 +0200 Subject: [PATCH 04/12] Add warning delay for holidays --- htdocs/admin/delais.php | 6 ++++++ htdocs/core/class/conf.class.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index a48be10b4e0..8632b199d39 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -120,6 +120,12 @@ $modules=array( 'img' => 'trip' )*/ ), + 'holiday' => array( + array( + 'code' => 'MAIN_DELAY_HOLIDAYS', + 'img' => 'holiday' + ), + ), ); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 35705b661d9..f8345f3aaf4 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -615,6 +615,10 @@ class Conf $this->expensereport->payment = new stdClass(); $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; } + if (isset($this->holiday)) { + $this->holiday->approve = new stdClass(); + $this->holiday->approve->warning_delay=(isset($this->global->MAIN_DELAY_HOLIDAYS)?$this->global->MAIN_DELAY_HOLIDAYS:0)*24*60*60; + } if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT)) { From ea4dcbc77a213df8c3a398c3bd28a025f91804fe Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 17:04:24 +0200 Subject: [PATCH 05/12] Add translation --- htdocs/langs/en_US/holiday.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 2fad3d02a7f..c3cdda3cfd6 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -126,4 +126,5 @@ HolidaySetup=Setup of module Holiday HolidaysNumberingModules=Leave requests numbering models TemplatePDFHolidays=Template for leave requests PDF FreeLegalTextOnHolidays=Free text on PDF -WatermarkOnDraftHolidayCards=Watermarks on draft leave requests \ No newline at end of file +WatermarkOnDraftHolidayCards=Watermarks on draft leave requests +HolidaysToApprove=Holidays to approve \ No newline at end of file From 4f64250ad670517d315cc4a3d799f78d46ad5a4d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 17:12:25 +0200 Subject: [PATCH 06/12] Fix menu links for holidays --- htdocs/core/menus/standard/eldy.lib.php | 28 ++++++++++++------------- htdocs/holiday/class/holiday.class.php | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 11ef4a474df..2d4a5c7f4c1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1439,9 +1439,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("hrm"); - $newmenu->add("/user/list.php?leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm'); - $newmenu->add("/user/card.php?action=create&employee=1", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write); - $newmenu->add("/user/list.php?leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1,$user->rights->hrm->employee->read); + $newmenu->add("/user/list.php?mainmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm'); + $newmenu->add("/user/card.php?mainmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write); + $newmenu->add("/user/list.php?mainmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1,$user->rights->hrm->employee->read); } // Leave/Holiday/Vacation module @@ -1450,17 +1450,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Load translation files required by the page $langs->loadLangs(array("holiday","trips")); - $newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); - $newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1,$user->rights->holiday->write); - $newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); - $newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("New"), 1,$user->rights->holiday->write); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1,$user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="holiday") $newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); } // Trips and expenses (old module) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 84d0d7ae1ed..d09bbda3cf8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2243,7 +2243,7 @@ class Holiday extends CommonObject $response = new WorkboardResponse(); $response->warning_delay=$conf->holiday->approve->warning_delay/60/60/24; $response->label=$langs->trans("HolidaysToApprove"); - $response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&leftmenu=hrm'; + $response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday'; $response->img=img_object('', "holiday"); while ($obj=$this->db->fetch_object($resql)) From 9b805f742b577fb26360fe3d83dec348ccdbcd5c Mon Sep 17 00:00:00 2001 From: ATM-Marc Date: Sat, 18 May 2019 20:09:00 +0200 Subject: [PATCH 07/12] FIX: modulebuilder: hardcoded llx_ --- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 12f31439985..7593d0c550e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -90,7 +90,7 @@ class MyObject extends CommonObject 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'user.rowid'), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), From 3e3ed6f9e7b897b84d39c28b2083a134ac1a1977 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 May 2019 20:11:51 +0200 Subject: [PATCH 08/12] Fix phpcs --- htdocs/holiday/class/holiday.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index d09bbda3cf8..b226be03cf7 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2178,15 +2178,15 @@ class Holiday extends CommonObject $this->statut=Holiday::STATUS_VALIDATED; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Load this->nb for dashboard * * @return int <0 if KO, >0 if OK */ public function load_state_board() { - global $conf; - + // phpcs:enable $this->nb=array(); $sql = "SELECT count(h.rowid) as nb"; @@ -2210,11 +2210,11 @@ class Holiday extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @param string $option 'toapprove' * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ public function load_board($user) From 1d980342ec6929516e0ab977477969cd181de22f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 19 May 2019 00:05:23 +0200 Subject: [PATCH 09/12] Fix #8344 --- htdocs/core/lib/functions2.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index dc223f58ec3..c229a26ec3c 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1244,6 +1244,10 @@ function check_value($mask,$value) if (! empty($reg[3]) && preg_match('/^@/',$reg[3])) $maskraz=preg_replace('/^@/','',$reg[3]); if ($maskraz >= 0) { + if ($maskraz == 99) { + $maskraz = date('m'); + $resetEveryMonth = true; + } if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; // Define reg From 83c38570e9d7deddfa8f05db3c0534c7b5f4d41a Mon Sep 17 00:00:00 2001 From: ATM-Marc Date: Sun, 19 May 2019 01:01:21 +0200 Subject: [PATCH 10/12] FIX: invoice class: bad SQL request if product type not set --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d303e6edf21..2d78b95990f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4492,7 +4492,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; - $sql.= " ".$this->product_type.","; + $sql.= " '".$this->product_type."',"; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; From 32485c27828e39810793b3f8c1e7cd103b6a8a49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 01:45:33 +0200 Subject: [PATCH 11/12] Fix phpcs --- htdocs/holiday/class/holiday.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index b226be03cf7..ca31d84f48b 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2178,7 +2178,7 @@ class Holiday extends CommonObject $this->statut=Holiday::STATUS_VALIDATED; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load this->nb for dashboard * @@ -2210,7 +2210,7 @@ class Holiday extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * From 2fd3eb8bdf2f2810d117915cecb14f210ef5783c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 01:58:01 +0200 Subject: [PATCH 12/12] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2d78b95990f..93f67a5a064 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4492,7 +4492,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; - $sql.= " '".$this->product_type."',"; + $sql.= " ".((int) $this->product_type).","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';