From 31094936c1ab3524c0e07ee17d1b2c91a5a2a92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Sep 2019 10:56:11 +0200 Subject: [PATCH 1/8] wip --- htdocs/core/boxes/box_contracts.php | 5 ++++- htdocs/core/boxes/box_factures_fourn.php | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 43ade84ad20..c304800f4c1 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -84,7 +84,8 @@ class box_contracts extends ModeleBoxes $thirdpartytmp=new Societe($db); $sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; - $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; + $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; + $sql.= ", c.ref_customer, c.ref_supplier"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; @@ -117,6 +118,8 @@ class box_contracts extends ModeleBoxes $contractstatic->statut=$objp->fk_statut; $contractstatic->id=$objp->rowid; $contractstatic->ref=$objp->ref; + $contractstatic->ref_customer = $objp->ref_customer; + $contractstatic->ref_supplier = $objp->ref_supplier; $result=$contractstatic->fetch_lines(); $thirdpartytmp->name = $objp->name; diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 9d2e8e995e3..ce355f53e1e 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -87,7 +87,7 @@ class box_factures_fourn extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " s.code_fournisseur,"; + $sql.= " s.code_fournisseur, s.email,"; $sql.= " s.logo,"; $sql.= " f.rowid as facid, f.ref, f.ref_supplier,"; $sql.= " f.total_ht,"; @@ -133,6 +133,7 @@ class box_factures_fourn extends ModeleBoxes $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; + $thirdpartytmp->email = $objp->email; $thirdpartytmp->fournisseur = 1; $thirdpartytmp->code_fournisseur = $objp->code_fournisseur; $thirdpartytmp->logo = $objp->logo; From 57509f1312e9baad2b2ecd9eeb35f76016873237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Sep 2019 18:13:26 +0200 Subject: [PATCH 2/8] box ficheinter --- htdocs/core/boxes/box_ficheinter.php | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 8311ae7226c..2755e7a3f0d 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -70,12 +70,13 @@ class box_ficheinter extends ModeleBoxes */ public function loadBox($max = 10) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; - $ficheinterstatic=new Fichinter($db); + $ficheinterstatic=new Fichinter($this->db); + $companystatic = new Societe($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastFicheInter", $max)); @@ -85,7 +86,7 @@ class box_ficheinter extends ModeleBoxes $sql.= " f.datec,"; $sql.= " f.date_valid as datev,"; $sql.= " f.tms as datem,"; - $sql.= " s.nom as name, s.rowid as socid, s.client"; + $sql.= " s.nom as name, s.rowid as socid, s.client, s.email as semail"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."fichinter as f"; @@ -94,42 +95,40 @@ class box_ficheinter extends ModeleBoxes if (! $user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= " ORDER BY f.tms DESC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this).'::loadBox', LOG_DEBUG); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $now=dol_now(); $i = 0; while ($i < $num) { - $objp = $db->fetch_object($resql); - $datec=$db->jdate($objp->datec); + $objp = $this->db->fetch_object($resql); + $datec = $this->db->jdate($objp->datec); $ficheinterstatic->statut=$objp->fk_statut; $ficheinterstatic->id=$objp->rowid; $ficheinterstatic->ref=$objp->ref; + $companystatic->id = $objp->socid; + $companystatic->name = $objp->name; + $companystatic->email = $objp->semail; + $this->info_box_contents[$i][] = array( 'td' => '', 'text' => $ficheinterstatic->getNomUrl(1), 'asis' => 1, ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, - ); - $this->info_box_contents[$i][] = array( 'td' => '', - 'text' => dol_trunc($objp->name, 40), - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $companystatic->getNomUrl(1), + 'asis' => 1, ); $this->info_box_contents[$i][] = array( @@ -148,14 +147,14 @@ class box_ficheinter extends ModeleBoxes if ($num==0) $this->info_box_contents[$i][] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedInterventions")); - $db->free($resql); + $this->db->free($resql); } else { $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } From 8f41e0f9fe25eb6f17964753c7d2fdd814068cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Sep 2019 18:39:21 +0200 Subject: [PATCH 3/8] clean code --- htdocs/core/boxes/box_actions.php | 20 +++---- htdocs/core/boxes/box_activity.php | 56 +++++++++---------- htdocs/core/boxes/box_birthdays.php | 18 +++--- htdocs/core/boxes/box_birthdays_members.php | 24 ++++---- htdocs/core/boxes/box_bookmarks.php | 16 +++--- htdocs/core/boxes/box_clients.php | 20 +++---- htdocs/core/boxes/box_commandes.php | 24 ++++---- htdocs/core/boxes/box_comptes.php | 16 +++--- htdocs/core/boxes/box_contacts.php | 22 ++++---- htdocs/core/boxes/box_contracts.php | 24 ++++---- htdocs/core/boxes/box_factures.php | 26 ++++----- htdocs/core/boxes/box_factures_fourn.php | 26 ++++----- htdocs/core/boxes/box_factures_fourn_imp.php | 28 +++++----- htdocs/core/boxes/box_factures_imp.php | 22 ++++---- htdocs/core/boxes/box_fournisseurs.php | 22 ++++---- htdocs/core/boxes/box_goodcustomers.php | 22 ++++---- .../boxes/box_graph_invoices_permonth.php | 4 +- .../box_graph_invoices_supplier_permonth.php | 2 +- .../core/boxes/box_graph_orders_permonth.php | 4 +- .../box_graph_orders_supplier_permonth.php | 2 +- .../boxes/box_graph_product_distribution.php | 2 +- .../boxes/box_graph_propales_permonth.php | 4 +- .../core/boxes/box_last_modified_ticket.php | 31 +++++----- htdocs/core/boxes/box_last_ticket.php | 25 +++++---- htdocs/core/boxes/box_lastlogin.php | 2 +- htdocs/core/boxes/box_members.php | 22 ++++---- htdocs/core/boxes/box_produits.php | 24 ++++---- .../core/boxes/box_produits_alerte_stock.php | 28 +++++----- htdocs/core/boxes/box_project.php | 14 ++--- htdocs/core/boxes/box_propales.php | 28 +++++----- htdocs/core/boxes/box_prospect.php | 20 +++---- htdocs/core/boxes/box_services_contracts.php | 32 +++++------ htdocs/core/boxes/box_services_expired.php | 18 +++--- htdocs/core/boxes/box_supplier_orders.php | 22 ++++---- htdocs/core/boxes/box_task.php | 14 ++--- 35 files changed, 345 insertions(+), 339 deletions(-) diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 994b604ae78..67718e7fb8e 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -71,14 +71,14 @@ class box_actions extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - $societestatic = new Societe($db); - $actionstatic = new ActionComm($db); + $societestatic = new Societe($this->db); + $actionstatic = new ActionComm($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo", $max)); @@ -99,20 +99,20 @@ class box_actions extends ModeleBoxes if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")"; $sql.= " ORDER BY a.datec DESC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog("Box_actions::loadBox", LOG_DEBUG); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { $now=dol_now(); $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { $late = ''; - $objp = $db->fetch_object($result); - $datelimite = $db->jdate($objp->dp); + $objp = $this->db->fetch_object($result); + $datelimite = $this->db->jdate($objp->dp); $actionstatic->id = $objp->id; $actionstatic->label = $objp->label; $actionstatic->type_label = $objp->type_label; @@ -164,12 +164,12 @@ class box_actions extends ModeleBoxes 'text'=>$langs->trans("NoActionsToDo"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 72116993505..0b690240db6 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -76,7 +76,7 @@ class box_activity extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -103,7 +103,7 @@ class box_activity extends ModeleBoxes if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $propalstatic=new Propal($db); + $propalstatic=new Propal($this->db); $cachedir = DOL_DATA_ROOT.'/propale/temp'; $filename = '/boxactivity-propal'.$fileid; @@ -119,27 +119,27 @@ class box_activity extends ModeleBoxes $sql.= " AND p.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " AND p.datep >= '".$db->idate($tmpdate)."'"; + $sql.= " AND p.datep >= '".$this->db->idate($tmpdate)."'"; $sql.= " AND p.date_cloture IS NULL"; // just unclosed $sql.= " GROUP BY p.fk_statut"; $sql.= " ORDER BY p.fk_statut DESC"; - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $j=0; while ($j < $num) { - $data[$j]=$db->fetch_object($result); + $data[$j]=$this->db->fetch_object($result); $j++; } if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { dol_filecache($cachedir, $filename, $data); } - $db->free($result); + $this->db->free($result); } else { - dol_print_error($db); + dol_print_error($this->db); } } else @@ -190,7 +190,7 @@ class box_activity extends ModeleBoxes // list the summary of the orders if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $commandestatic=new Commande($db); + $commandestatic=new Commande($this->db); $langs->load("orders"); @@ -209,24 +209,24 @@ class box_activity extends ModeleBoxes $sql.= " AND c.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'"; + $sql.= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'"; $sql.= " GROUP BY c.fk_statut"; $sql.= " ORDER BY c.fk_statut DESC"; - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $j=0; while ($j < $num) { - $data[$j]=$db->fetch_object($result); + $data[$j]=$this->db->fetch_object($result); $j++; } if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { dol_filecache($cachedir, $filename, $data); } - $db->free($result); + $this->db->free($result); } else { - dol_print_error($db); + dol_print_error($this->db); } } else { $data = dol_readcachefile($cachedir, $filename); @@ -275,7 +275,7 @@ class box_activity extends ModeleBoxes if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($db); + $facturestatic=new Facture($this->db); // part 1 $cachedir = DOL_DATA_ROOT.'/facture/temp'; @@ -293,24 +293,24 @@ class box_activity extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=1"; + $sql.= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1"; $sql.= " GROUP BY f.fk_statut"; $sql.= " ORDER BY f.fk_statut DESC"; - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $j=0; while ($j < $num) { - $data[$j]=$db->fetch_object($result); + $data[$j]=$this->db->fetch_object($result); $j++; } if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { dol_filecache($cachedir, $filename, $data); } - $db->free($result); + $this->db->free($result); } else { - dol_print_error($db); + dol_print_error($this->db); } } else { $data = dol_readcachefile($cachedir, $filename); @@ -373,24 +373,24 @@ class box_activity extends ModeleBoxes $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " WHERE f.entity IN (".getEntity('invoice').')'; $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=0"; + $sql.= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0"; $sql.= " GROUP BY f.fk_statut"; $sql.= " ORDER BY f.fk_statut DESC"; - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $j=0; while ($j < $num) { - $data[$j]=$db->fetch_object($result); + $data[$j]=$this->db->fetch_object($result); $j++; } if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { dol_filecache($cachedir, $filename, $data); } - $db->free($result); + $this->db->free($result); } else { - dol_print_error($db); + dol_print_error($this->db); } } else { $data = dol_readcachefile($cachedir, $filename); diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index f15c5c8d1cb..8204543540e 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -71,13 +71,13 @@ class box_birthdays extends ModeleBoxes */ public function loadBox($max = 20) { - global $user, $langs, $db; + global $user, $langs; $langs->load("boxes"); $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $userstatic=new User($db); + $userstatic=new User($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleUserBirthdaysOfMonth")); @@ -89,23 +89,23 @@ class box_birthdays extends ModeleBoxes $sql.= " WHERE u.entity IN (".getEntity('user').")"; $sql.= " AND MONTH(u.birth) = ".date('m'); $sql.= " ORDER BY u.birth ASC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); + $objp = $this->db->fetch_object($result); $userstatic->id = $objp->rowid; $userstatic->firstname = $objp->firstname; $userstatic->lastname = $objp->lastname; $userstatic->email = $objp->email; - $dateb=$db->jdate($objp->birth); + $dateb=$this->db->jdate($objp->birth); $age = date('Y', dol_now()) - date('Y', $dateb); $this->info_box_contents[$line][] = array( @@ -129,13 +129,13 @@ class box_birthdays extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql) + 'text' => ($this->db->error().' sql='.$sql) ); } } diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 446b74a184c..45f64adce42 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -71,42 +71,42 @@ class box_birthdays_members extends ModeleBoxes */ public function loadBox($max = 20) { - global $user, $langs, $db; + global $user, $langs; $langs->load("boxes"); $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $memberstatic=new Adherent($db); + $memberstatic=new Adherent($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleMemberNextBirthdays")); if ($user->rights->adherent->lire) { $sql = "SELECT u.rowid, u.firstname, u.lastname"; - $sql.= ", u.birth"; + $sql.= ", u.birth"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as u"; $sql.= " WHERE u.entity IN (".getEntity('adherent').")"; - $sql.= " AND u.statut = 1"; - $sql.= " AND date_format(u.birth, '%m-%d') >= date_format(curdate(), '%m-%d')"; + $sql.= " AND u.statut = 1"; + $sql.= " AND date_format(u.birth, '%m-%d') >= date_format(curdate(), '%m-%d')"; $sql.= " ORDER BY date_format(u.birth, '%m-%d') ASC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); + $objp = $this->db->fetch_object($result); $memberstatic->id = $objp->rowid; $memberstatic->firstname = $objp->firstname; $memberstatic->lastname = $objp->lastname; $memberstatic->email = $objp->email; - $dateb=$db->jdate($objp->birth); + $dateb=$this->db->jdate($objp->birth); $age = date('Y', dol_now()) - date('Y', $dateb); $this->info_box_contents[$line][] = array( @@ -130,13 +130,13 @@ class box_birthdays_members extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql) + 'text' => ($this->db->error().' sql='.$sql) ); } } diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index bb35c311f00..6edd7fa9866 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -67,7 +67,7 @@ class box_bookmarks extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $langs->load("boxes"); $this->max=$max; @@ -92,18 +92,18 @@ class box_bookmarks extends ModeleBoxes $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b"; $sql.= " WHERE fk_user = ".$user->id; $sql.= " AND b.entity = ".$conf->entity; - $sql.= $db->order("position", "ASC"); - $sql.= $db->plimit($max, 0); + $sql.= $this->db->order("position", "ASC"); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); + $objp = $this->db->fetch_object($result); $this->info_box_contents[$line][0] = array( 'td' => 'class="left" width="16"', @@ -133,12 +133,12 @@ class box_bookmarks extends ModeleBoxes ); } - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index ea2a7814f14..858a99921f3 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -74,13 +74,13 @@ class box_clients extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $langs->load("boxes"); $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdpartystatic=new Societe($db); + $thirdpartystatic=new Societe($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max)); @@ -103,20 +103,20 @@ class box_clients extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id"; $sql.= " ORDER BY s.tms DESC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datec=$db->jdate($objp->datec); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datec=$this->db->jdate($objp->datec); + $datem=$this->db->jdate($objp->tms); $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; @@ -149,13 +149,13 @@ class box_clients extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedCustomers")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql) + 'text' => ($this->db->error().' sql='.$sql) ); } } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index e0d7d1fee4d..9084b6ad71a 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -71,16 +71,16 @@ class box_commandes extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $commandestatic = new Commande($db); - $societestatic = new Societe($db); - $userstatic = new User($db); + $commandestatic = new Commande($this->db); + $societestatic = new Societe($this->db); + $userstatic = new User($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerOrders", $max)); @@ -110,18 +110,18 @@ class box_commandes extends ModeleBoxes if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $date=$db->jdate($objp->date_commande); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $date=$this->db->jdate($objp->date_commande); + $datem=$this->db->jdate($objp->tms); $commandestatic->id = $objp->rowid; $commandestatic->ref = $objp->ref; $commandestatic->ref_client = $objp->ref_client; @@ -174,12 +174,12 @@ class box_commandes extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedOrders")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 1928ac7cc94..4cd053b82fc 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -77,7 +77,7 @@ class box_comptes extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; @@ -97,19 +97,19 @@ class box_comptes extends ModeleBoxes $sql.= " AND clos = 0"; //$sql.= " AND courant = 1"; $sql.= " ORDER BY label"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; $solde_total = array(); - $account_static = new Account($db); + $account_static = new Account($this->db); while ($line < $num) { - $objp = $db->fetch_object($result); + $objp = $this->db->fetch_object($result); $account_static->id = $objp->rowid; $account_static->ref = $objp->ref; @@ -160,12 +160,12 @@ class box_comptes extends ModeleBoxes $line++; } - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 667f892bc0a..02f62324200 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -73,7 +73,7 @@ class box_contacts extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $langs->load("boxes"); $this->max=$max; @@ -93,21 +93,21 @@ class box_contacts extends ModeleBoxes if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id; $sql.= " ORDER BY sp.tms DESC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); - $contactstatic=new Contact($db); - $societestatic=new Societe($db); + $contactstatic=new Contact($this->db); + $societestatic=new Societe($this->db); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datec=$db->jdate($objp->datec); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datec=$this->db->jdate($objp->datec); + $datem=$this->db->jdate($objp->tms); $contactstatic->id=$objp->id; $contactstatic->lastname=$objp->lastname; @@ -161,12 +161,12 @@ class box_contacts extends ModeleBoxes 'text'=>$langs->trans("NoRecordedContacts"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index c304800f4c1..eb4a8c44ed0 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -70,7 +70,7 @@ class box_contracts extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; @@ -80,8 +80,8 @@ class box_contracts extends ModeleBoxes if ($user->rights->contrat->lire) { - $contractstatic=new Contrat($db); - $thirdpartytmp=new Societe($db); + $contractstatic=new Contrat($this->db); + $thirdpartytmp=new Societe($this->db); $sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; @@ -94,12 +94,12 @@ class box_contracts extends ModeleBoxes if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_contrat DESC, c.ref DESC "; else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $now=dol_now(); $line = 0; @@ -108,11 +108,11 @@ class box_contracts extends ModeleBoxes while ($line < $num) { - $objp = $db->fetch_object($resql); + $objp = $this->db->fetch_object($resql); - $datec=$db->jdate($objp->datec); - $dateterm=$db->jdate($objp->fin_validite); - $dateclose=$db->jdate($objp->date_cloture); + $datec=$this->db->jdate($objp->datec); + $dateterm=$this->db->jdate($objp->fin_validite); + $dateclose=$this->db->jdate($objp->date_cloture); $late = ''; $contractstatic->statut=$objp->fk_statut; @@ -168,12 +168,12 @@ class box_contracts extends ModeleBoxes 'text'=>$langs->trans("NoRecordedContracts"), ); - $db->free($resql); + $this->db->free($resql); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 05ab5db50fd..fd1203ac520 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -69,15 +69,15 @@ class box_factures extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $facturestatic = new Facture($db); - $societestatic = new Societe($db); + $facturestatic = new Facture($this->db); + $societestatic = new Societe($this->db); $langs->load("bills"); @@ -105,22 +105,22 @@ class box_factures extends ModeleBoxes if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC "; else $sql.= " ORDER BY f.tms DESC, f.ref DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $now=dol_now(); $line = 0; $l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)'; while ($line < $num) { - $objp = $db->fetch_object($result); - $datelimite = $db->jdate($objp->datelimite); - $date = $db->jdate($objp->df); - $datem = $db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datelimite = $this->db->jdate($objp->datelimite); + $date = $this->db->jdate($objp->df); + $datem = $this->db->jdate($objp->tms); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; @@ -129,7 +129,7 @@ class box_factures extends ModeleBoxes $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->statut = $objp->fk_statut; - $facturestatic->date_lim_reglement = $db->jdate($objp->datelimite); + $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); $societestatic->id = $objp->socid; $societestatic->name = $objp->name; @@ -185,12 +185,12 @@ class box_factures extends ModeleBoxes 'text'=>$langs->trans("NoRecordedInvoices"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index ce355f53e1e..05cd900623e 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -70,15 +70,15 @@ class box_factures_fourn extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; - $facturestatic = new FactureFournisseur($db); - $thirdpartytmp = new Fournisseur($db); + $facturestatic = new FactureFournisseur($this->db); + $thirdpartytmp = new Fournisseur($this->db); $this->info_box_head = array( 'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills", $max) @@ -106,21 +106,21 @@ class box_factures_fourn extends ModeleBoxes if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC "; else $sql.= " ORDER BY f.tms DESC, f.ref DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; $l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)'; while ($line < $num) { - $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->datelimite); - $date=$db->jdate($objp->df); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datelimite=$this->db->jdate($objp->datelimite); + $date=$this->db->jdate($objp->df); + $datem=$this->db->jdate($objp->tms); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; @@ -174,7 +174,7 @@ class box_factures_fourn extends ModeleBoxes 'text' => dol_print_date($date, 'day'), ); - $fac = new FactureFournisseur($db); + $fac = new FactureFournisseur($this->db); $fac->fetch($objp->facid); $alreadypaid=$fac->getSommePaiement(); $this->info_box_contents[$line][] = array( @@ -191,12 +191,12 @@ class box_factures_fourn extends ModeleBoxes 'text'=>$langs->trans("NoModifiedSupplierBills"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index a28f275dc96..b6066255a17 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -69,14 +69,14 @@ class box_factures_fourn_imp extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $facturestatic=new FactureFournisseur($db); + $facturestatic=new FactureFournisseur($this->db); include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; - $thirdpartytmp=new Fournisseur($db); + $thirdpartytmp=new Fournisseur($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills", $max)); @@ -99,24 +99,24 @@ class box_factures_fourn_imp extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= " ORDER BY datelimite DESC, f.ref_supplier DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; $l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)'; - $facturestatic = new FactureFournisseur($db); + $facturestatic = new FactureFournisseur($this->db); while ($line < $num) { - $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->datelimite); - $date=$db->jdate($objp->df); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datelimite=$this->db->jdate($objp->datelimite); + $date=$this->db->jdate($objp->df); + $datem=$this->db->jdate($objp->tms); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->total_ht = $objp->total_ht; @@ -160,7 +160,7 @@ class box_factures_fourn_imp extends ModeleBoxes 'text' => dol_print_date($datelimite, 'day'), ); - $fac = new FactureFournisseur($db); + $fac = new FactureFournisseur($this->db); $fac->fetch($objp->facid); $alreadypaid=$fac->getSommePaiement(); $this->info_box_contents[$line][] = array( @@ -177,12 +177,12 @@ class box_factures_fourn_imp extends ModeleBoxes 'text'=>$langs->trans("NoUnpaidSupplierBills"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 5dfa6c8c492..9880d236a8e 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -72,15 +72,15 @@ class box_factures_imp extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $facturestatic = new Facture($db); - $societestatic = new Societe($db); + $facturestatic = new Facture($this->db); + $societestatic = new Societe($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max)); @@ -111,12 +111,12 @@ class box_factures_imp extends ModeleBoxes $sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; //$sql.= " ORDER BY f.datef DESC, f.ref DESC "; $sql.= " ORDER BY datelimite ASC, f.ref ASC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $now=dol_now(); $line = 0; @@ -124,8 +124,8 @@ class box_factures_imp extends ModeleBoxes while ($line < $num) { - $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->datelimite); + $objp = $this->db->fetch_object($result); + $datelimite=$this->db->jdate($objp->datelimite); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->type = $objp->type; @@ -133,7 +133,7 @@ class box_factures_imp extends ModeleBoxes $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->statut = $objp->fk_statut; - $facturestatic->date_lim_reglement = $db->jdate($objp->datelimite); + $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); $societestatic->id = $objp->socid; $societestatic->name = $objp->name; @@ -180,14 +180,14 @@ class box_factures_imp extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoUnpaidCustomerBills")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 8d231cc472b..ff73e80b21c 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -70,15 +70,15 @@ class box_fournisseurs extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $langs->load("boxes"); $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdpartystatic=new Societe($db); + $thirdpartystatic=new Societe($this->db); include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; - $thirdpartytmp=new Fournisseur($db); + $thirdpartytmp=new Fournisseur($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max)); @@ -94,19 +94,19 @@ class box_fournisseurs extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= " ORDER BY s.tms DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datec=$db->jdate($objp->datec); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datec=$this->db->jdate($objp->datec); + $datem=$this->db->jdate($objp->tms); $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->code_client = $objp->code_client; @@ -136,12 +136,12 @@ class box_fournisseurs extends ModeleBoxes 'text'=>$langs->trans("NoRecordedSuppliers"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index ea973caf773..3f0cea0651a 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -76,13 +76,13 @@ class box_goodcustomers extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $langs->load("boxes"); $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdpartystatic=new Societe($db); + $thirdpartystatic=new Societe($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleGoodCustomers", $max)); @@ -90,25 +90,25 @@ class box_goodcustomers extends ModeleBoxes { $sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,"; - $sql.= " count(*) as nbfact, sum(". $db->ifsql('f.paye=1', '1', '0').") as nbfactpaye"; + $sql.= " count(*) as nbfact, sum(". $this->db->ifsql('f.paye=1', '1', '0').") as nbfactpaye"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; $sql.= ' WHERE s.entity IN ('.getEntity('societe').')'; $sql.= ' AND s.rowid = f.fk_soc'; $sql.= " GROUP BY s.rowid, s.nom, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms, s.status"; - $sql.= $db->order("nbfact", "DESC"); - $sql.= $db->plimit($max, 0); + $sql.= $this->db->order("nbfact", "DESC"); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datem=$this->db->jdate($objp->tms); $thirdpartystatic->id = $objp->rowid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; @@ -145,13 +145,13 @@ class box_goodcustomers extends ModeleBoxes if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedCustomers")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 6e5afe5df99..b83630f8916 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -65,14 +65,14 @@ class box_graph_invoices_permonth extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; $refreshaction='refresh_'.$this->boxcode; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - //$facturestatic=new Facture($db); + //$facturestatic=new Facture($this->db); $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index df4f4afc146..0b395946731 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -65,7 +65,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index b530b4ea268..1a1e29fb47a 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -65,14 +65,14 @@ class box_graph_orders_permonth extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; $refreshaction='refresh_'.$this->boxcode; //include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - //$commandestatic=new Commande($db); + //$commandestatic=new Commande($this->db); $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 8359ddbe070..da956670779 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -65,7 +65,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index d32c9bb1918..dac5137938a 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -72,7 +72,7 @@ class box_graph_product_distribution extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 36a35c3bbc2..98b12cf65f4 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -65,14 +65,14 @@ class box_graph_propales_permonth extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; $refreshaction='refresh_'.$this->boxcode; //include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - //$propalstatic=new Propal($db); + //$propalstatic=new Propal($this->db); $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index e9f00049e04..4de36596cc7 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -47,11 +47,14 @@ class box_last_modified_ticket extends ModeleBoxes /** * Constructor + * @param DoliDB $db Database handler + * @param string $param More parameters */ - public function __construct() + public function __construct($db, $param = '') { global $langs; - $langs->load("boxes"); + $langs->load("boxes"); + $this->db = $db; $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedTicket"); } @@ -64,7 +67,7 @@ class box_last_modified_ticket extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max = $max; @@ -72,8 +75,8 @@ class box_last_modified_ticket extends ModeleBoxes $text = $langs->trans("BoxLastModifiedTicketDescription", $max); $this->info_box_head = array( - 'text' => $text, - 'limit' => dol_strlen($text) + 'text' => $text, + 'limit' => dol_strlen($text) ); $this->info_box_contents[0][0] = array( @@ -99,20 +102,20 @@ class box_last_modified_ticket extends ModeleBoxes } $sql.= " ORDER BY t.tms DESC, t.rowid DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $now=gmmktime(); $i = 0; while ($i < $num) { - $objp = $db->fetch_object($resql); - $datec=$db->jdate($objp->datec); - $dateterm=$db->jdate($objp->fin_validite); - $dateclose=$db->jdate($objp->date_cloture); + $objp = $this->db->fetch_object($resql); + $datec=$this->db->jdate($objp->datec); + $dateterm=$this->db->jdate($objp->fin_validite); + $dateclose=$this->db->jdate($objp->date_cloture); $late = ''; $ticket = new Ticket($this->db); @@ -157,7 +160,7 @@ class box_last_modified_ticket extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', - 'text' => dol_print_date($db->idate($objp->datec), 'dayhour') + 'text' => dol_print_date($this->db->idate($objp->datec), 'dayhour') ); $r++; @@ -177,7 +180,7 @@ class box_last_modified_ticket extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'class="center"','text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets")); } } else { - dol_print_error($db); + dol_print_error($this->db); } } else { $this->info_box_contents[0][0] = array( diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index 352a10db682..708c4e97633 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -46,11 +46,14 @@ class box_last_ticket extends ModeleBoxes /** * Constructor + * @param DoliDB $db Database handler + * @param string $param More parameters */ - public function __construct() + public function __construct($db, $param = '') { global $langs; $langs->load("boxes"); + $this->db = $db; $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastTicket"); } @@ -63,7 +66,7 @@ class box_last_ticket extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max = $max; @@ -100,20 +103,20 @@ class box_last_ticket extends ModeleBoxes //$sql.= " AND t.fk_statut > 9"; $sql .= " ORDER BY t.datec DESC, t.rowid DESC "; - $sql .= $db->plimit($max, 0); + $sql .= $this->db->plimit($max, 0); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $now = gmmktime(); $i = 0; while ($i < $num) { - $objp = $db->fetch_object($resql); - $datec = $db->jdate($objp->datec); - $dateterm = $db->jdate($objp->fin_validite); - $dateclose = $db->jdate($objp->date_cloture); + $objp = $this->db->fetch_object($resql); + $datec = $this->db->jdate($objp->datec); + $dateterm = $this->db->jdate($objp->fin_validite); + $dateclose = $this->db->jdate($objp->date_cloture); $late = ''; $ticket = new Ticket($this->db); @@ -156,7 +159,7 @@ class box_last_ticket extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', - 'text' => dol_print_date($db->idate($objp->datec), 'dayhour'), + 'text' => dol_print_date($this->db->idate($objp->datec), 'dayhour'), ); $r++; @@ -176,7 +179,7 @@ class box_last_ticket extends ModeleBoxes $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text' => $langs->trans("BoxLastTicketNoRecordedTickets")); } } else { - dol_print_error($db); + dol_print_error($this->db); } } else { $this->info_box_contents[0][0] = array('td' => 'class="left"', diff --git a/htdocs/core/boxes/box_lastlogin.php b/htdocs/core/boxes/box_lastlogin.php index 8a5b90ae9d5..997f3b8ca26 100644 --- a/htdocs/core/boxes/box_lastlogin.php +++ b/htdocs/core/boxes/box_lastlogin.php @@ -68,7 +68,7 @@ class box_lastlogin extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $textHead = $langs->trans("BoxLoginInformation"); $this->info_box_head = array( diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index b0f1200dec7..20bf6ca136f 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -76,13 +76,13 @@ class box_members extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $langs->load("boxes"); $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $memberstatic=new Adherent($db); + $memberstatic=new Adherent($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max)); @@ -95,19 +95,19 @@ class box_members extends ModeleBoxes $sql.= " WHERE a.entity IN (".getEntity('member').")"; $sql.= " AND a.fk_adherent_type = t.rowid"; $sql.= " ORDER BY a.tms DESC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datec=$db->jdate($objp->datec); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datec=$this->db->jdate($objp->datec); + $datem=$this->db->jdate($objp->tms); $memberstatic->lastname=$objp->lastname; $memberstatic->firstname=$objp->firstname; @@ -142,7 +142,7 @@ class box_members extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $db->jdate($objp->date_end_subscription), 3), + 'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $this->db->jdate($objp->date_end_subscription), 3), ); $line++; @@ -154,12 +154,12 @@ class box_members extends ModeleBoxes 'text'=>$langs->trans("NoRecordedCustomers"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 68c1b4c790b..0f094c5369e 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -75,12 +75,12 @@ class box_produits extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf, $hookmanager; + global $user, $langs, $conf, $hookmanager; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $productstatic=new Product($db); + $productstatic=new Product($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts", $max)); @@ -98,18 +98,18 @@ class box_produits extends ModeleBoxes $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; } - $sql.= $db->order('p.datec', 'DESC'); - $sql.= $db->plimit($max, 0); + $sql.= $this->db->order('p.datec', 'DESC'); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datem=$this->db->jdate($objp->tms); // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active @@ -120,10 +120,10 @@ class box_produits extends ModeleBoxes $sqld.= " AND lang='". $langs->getDefaultLang() ."'"; $sqld.= " LIMIT 1"; - $resultd = $db->query($sqld); + $resultd = $this->db->query($sqld); if ($resultd) { - $objtp = $db->fetch_object($resultd); + $objtp = $this->db->fetch_object($resultd); if (isset($objtp->label) && $objtp->label != '') $objp->label = $objtp->label; } @@ -202,12 +202,12 @@ class box_produits extends ModeleBoxes 'text'=>$langs->trans("NoRecordedProducts"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 095709c2ea8..4f285c990cc 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -77,19 +77,19 @@ class box_produits_alerte_stock extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf, $hookmanager; + global $user, $langs, $conf, $hookmanager; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $productstatic=new Product($db); + $productstatic=new Product($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleProductsAlertStock", $max)); if (($user->rights->produit->lire || $user->rights->service->lire) && $user->rights->stock->lire) { $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity,"; - $sql.= " SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").") as total_stock"; + $sql.= " SUM(".$this->db->ifsql("s.reel IS NULL", "0", "s.reel").") as total_stock"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')'; @@ -104,19 +104,19 @@ class box_produits_alerte_stock extends ModeleBoxes $sql.=$hookmanager->resPrint; } $sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity"; - $sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").") < p.seuil_stock_alerte"; - $sql.= $db->order('p.seuil_stock_alerte', 'DESC'); - $sql.= $db->plimit($max, 0); + $sql.= " HAVING SUM(".$this->db->ifsql("s.reel IS NULL", "0", "s.reel").") < p.seuil_stock_alerte"; + $sql.= $this->db->order('p.seuil_stock_alerte', 'DESC'); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { $langs->load("stocks"); - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $datem=$this->db->jdate($objp->tms); $price = ''; $price_base_type = ''; @@ -129,10 +129,10 @@ class box_produits_alerte_stock extends ModeleBoxes $sqld.= " AND lang='". $langs->getDefaultLang() ."'"; $sqld.= " LIMIT 1"; - $resultd = $db->query($sqld); + $resultd = $this->db->query($sqld); if ($resultd) { - $objtp = $db->fetch_object($resultd); + $objtp = $this->db->fetch_object($resultd); if (isset($objtp->label) && $objtp->label != '') $objp->label = $objtp->label; } @@ -214,14 +214,14 @@ class box_produits_alerte_stock extends ModeleBoxes 'text'=>$langs->trans("NoTooLowStockProducts"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 3cd36c470fe..f1265bc6658 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -72,7 +72,7 @@ class box_project extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; @@ -102,15 +102,15 @@ class box_project extends ModeleBoxes if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users $sql.= " ORDER BY p.datec DESC"; - //$sql.= $db->plimit($max, 0); + //$sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $i = 0; while ($i < min($num, $max)) { - $objp = $db->fetch_object($result); + $objp = $this->db->fetch_object($result); $projectstatic->id = $objp->rowid; $projectstatic->ref = $objp->ref; @@ -132,9 +132,9 @@ class box_project extends ModeleBoxes $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; $sql.= " WHERE p.entity IN (".getEntity('project').')'; $sql.=" AND p.rowid = ".$objp->rowid; - $resultTask = $db->query($sql); + $resultTask = $this->db->query($sql); if ($resultTask) { - $objTask = $db->fetch_object($resultTask); + $objTask = $this->db->fetch_object($resultTask); $this->info_box_contents[$i][] = array( 'td' => 'class="right"', 'text' => $objTask->nb." ".$langs->trans("Tasks"), diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index f486463a32a..3b138eacd47 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -71,14 +71,14 @@ class box_propales extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $propalstatic=new Propal($db); - $societestatic = new Societe($db); + $propalstatic=new Propal($this->db); + $societestatic = new Societe($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals", $max)); @@ -95,23 +95,23 @@ class box_propales extends ModeleBoxes if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; else $sql.= " ORDER BY p.tms DESC, p.ref DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $now=dol_now(); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $date=$db->jdate($objp->dp); - $datec=$db->jdate($objp->datec); - $datem=$db->jdate($objp->tms); - $dateterm=$db->jdate($objp->fin_validite); - $dateclose=$db->jdate($objp->date_cloture); + $objp = $this->db->fetch_object($result); + $date=$this->db->jdate($objp->dp); + $datec=$this->db->jdate($objp->datec); + $datem=$this->db->jdate($objp->tms); + $dateterm=$this->db->jdate($objp->fin_validite); + $dateclose=$this->db->jdate($objp->date_cloture); $propalstatic->id = $objp->rowid; $propalstatic->ref = $objp->ref; $propalstatic->total_ht = $objp->total_ht; @@ -164,12 +164,12 @@ class box_propales extends ModeleBoxes 'text'=>$langs->trans("NoRecordedProposals"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 947ebc18b52..3011234a3fb 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -76,11 +76,11 @@ class box_prospect extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; - $thirdpartystatic=new Client($db); + $thirdpartystatic=new Client($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $max)); @@ -100,20 +100,20 @@ class box_prospect extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= " ORDER BY s.tms DESC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($resql); - $datec=$db->jdate($objp->datec); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($resql); + $datec=$this->db->jdate($objp->datec); + $datem=$this->db->jdate($objp->tms); $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; @@ -153,12 +153,12 @@ class box_prospect extends ModeleBoxes ); } - $db->free($resql); + $this->db->free($resql); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength' => 500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } else { diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index eaca6dc1548..3d852c7a190 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -71,22 +71,22 @@ class box_services_contracts extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - $form = new Form($db); + $form = new Form($this->db); $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract", $max)); if ($user->rights->service->lire && $user->rights->contrat->lire) { - $contractstatic=new Contrat($db); - $contractlinestatic=new ContratLigne($db); - $thirdpartytmp = new Societe($db); - $productstatic = new Product($db); + $contractstatic=new Contrat($this->db); + $contractlinestatic=new ContratLigne($this->db); + $thirdpartytmp = new Societe($this->db); + $productstatic = new Product($this->db); $sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql.= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,"; @@ -100,21 +100,21 @@ class box_services_contracts extends ModeleBoxes $sql.= ")"; $sql.= " WHERE c.entity = ".$conf->entity; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= $db->order("c.tms", "DESC"); - $sql.= $db->plimit($max, 0); + $sql.= $this->db->order("c.tms", "DESC"); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $now=dol_now(); $i = 0; while ($i < $num) { - $objp = $db->fetch_object($result); - $datem=$db->jdate($objp->datem); + $objp = $this->db->fetch_object($result); + $datem=$this->db->jdate($objp->datem); $contractlinestatic->id=$objp->cdid; $contractlinestatic->fk_contrat=$objp->rowid; @@ -149,10 +149,10 @@ class box_services_contracts extends ModeleBoxes $sqld.= " AND lang='". $langs->getDefaultLang() ."'"; $sqld.= " LIMIT 1"; - $resultd = $db->query($sqld); + $resultd = $this->db->query($sqld); if ($resultd) { - $objtp = $db->fetch_object($resultd); + $objtp = $this->db->fetch_object($resultd); if ($objtp->label != '') $contractlinestatic->label = $objtp->label; } } @@ -222,14 +222,14 @@ class box_services_contracts extends ModeleBoxes } if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'class="center"','text'=>$langs->trans("NoContractedProducts")); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength' => 500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 58262a16dec..f1f1c38dd59 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -69,7 +69,7 @@ class box_services_expired extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $db, $conf; + global $user, $langs, $conf; $this->max=$max; @@ -88,19 +88,19 @@ class box_services_expired extends ModeleBoxes $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$db->idate($now)."'"; + $sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$this->db->idate($now)."'"; $sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0"; if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid"; $sql.= " ORDER BY date_line ASC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $i = 0; @@ -111,7 +111,7 @@ class box_services_expired extends ModeleBoxes { $late=''; - $objp = $db->fetch_object($resql); + $objp = $this->db->fetch_object($resql); $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; @@ -129,7 +129,7 @@ class box_services_expired extends ModeleBoxes $contract->ref_customer = $objp->ref_customer; $contract->ref_supplier = $objp->ref_supplier; - $dateline=$db->jdate($objp->date_line); + $dateline=$this->db->jdate($objp->date_line); if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late")); $this->info_box_contents[$i][] = array( @@ -168,14 +168,14 @@ class box_services_expired extends ModeleBoxes ); } - $db->free($resql); + $this->db->free($resql); } else { $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 1ae1172de1d..6dc7385d363 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -69,15 +69,15 @@ class box_supplier_orders extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $langs->load("boxes"); $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - $supplierorderstatic=new CommandeFournisseur($db); + $supplierorderstatic=new CommandeFournisseur($this->db); include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; - $thirdpartytmp = new Fournisseur($db); + $thirdpartytmp = new Fournisseur($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierOrders", $max)); @@ -100,18 +100,18 @@ class box_supplier_orders extends ModeleBoxes if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $this->db->num_rows($result); $line = 0; while ($line < $num) { - $objp = $db->fetch_object($result); - $date=$db->jdate($objp->date_commande); - $datem=$db->jdate($objp->tms); + $objp = $this->db->fetch_object($result); + $date=$this->db->jdate($objp->date_commande); + $datem=$this->db->jdate($objp->tms); $supplierorderstatic->id = $objp->rowid; $supplierorderstatic->ref = $objp->ref; @@ -158,12 +158,12 @@ class box_supplier_orders extends ModeleBoxes 'text' => $langs->trans("NoSupplierOrder"), ); - $db->free($result); + $this->db->free($result); } else { $this->info_box_contents[0][] = array( 'td' => '', 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql), + 'text' => ($this->db->error().' sql='.$sql), ); } } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index cf1d5241753..b0c6306ac38 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -75,15 +75,15 @@ class box_task extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs, $db; + global $conf, $user, $langs; $this->max=$max; include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php"; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"; $projectstatic = new Project($this->db); - $taskstatic=new Task($db); - $form= new Form($db); + $taskstatic=new Task($this->db); + $form= new Form($this->db); $cookie_name='boxfilter_task'; $boxcontent=''; @@ -160,13 +160,13 @@ class box_task extends ModeleBoxes $sql.= " ORDER BY pt.datee ASC, pt.dateo ASC"; - $sql.= $db->plimit($max, 0); + $sql.= $this->db->plimit($max, 0); - $result = $db->query($sql); + $result = $this->db->query($sql); $i = 0; if ($result) { - $num = $db->num_rows($result); - while ($objp = $db->fetch_object($result)) { + $num = $this->db->num_rows($result); + while ($objp = $this->db->fetch_object($result)) { $taskstatic->id=$objp->rowid; $taskstatic->ref=$objp->ref; From b838ab0c319ae752a49303b49d7d65d04133e552 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 25 Sep 2019 12:13:27 +0200 Subject: [PATCH 4/8] Fix search by ref --- htdocs/takepos/ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index 74f69618a0f..1cb91f6edac 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -52,7 +52,7 @@ elseif ($action=="search" && $term != '') { $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; $sql.= ' WHERE entity IN ('.getEntity('product').')'; $sql.= ' AND tosell = 1'; - $sql.= natural_search(array('label','barcode'), $term); + $sql.= natural_search(array('ref','label','barcode'), $term); $resql = $db->query($sql); $rows = array(); while ($row = $db->fetch_array($resql)) { From 7d916495201a03550c4411c883bd11012db549fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2019 15:48:44 +0200 Subject: [PATCH 5/8] NEW Add extrafields in export of expense report (and holiday) --- htdocs/core/modules/modExpenseReport.class.php | 9 +++++++-- htdocs/core/modules/modHoliday.class.php | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index ea1ffb7f6a3..ac93d45d133 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -38,7 +38,7 @@ class modExpenseReport extends DolibarrModules */ public function __construct($db) { - global $conf; + global $conf, $user; // Required by some include code $this->db = $db; $this->numero = 770; @@ -200,8 +200,13 @@ class modExpenseReport extends DolibarrModules $this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.note_private'=>'note_private','d.note_public'=>'note_public','u.lastname'=>'name','u.firstname'=>'firstname','u.login'=>'login'); $this->export_dependencies_array[$r]=array('expensereport_line'=>'ed.rowid','type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $keyforselect='expensereport'; $keyforelement='expensereport'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expensereport as d, '.MAIN_DB_PREFIX.'user as u,'; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expensereport as d'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_extrafields as extra on d.rowid = extra.fk_object'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'user as u,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'expensereport_det as ed LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as tf ON ed.fk_c_type_fees = tf.id'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON ed.fk_projet = p.rowid'; $this->export_sql_end[$r] .=' WHERE ed.fk_expensereport = d.rowid AND d.fk_user_author = u.rowid'; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 61217d91686..2fd98887b87 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -219,8 +219,12 @@ class modHoliday extends DolibarrModules $this->export_special_array[$r] = array('none.num_open_days'=>'getNumOpenDays'); $this->export_dependencies_array[$r]=array(); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $keyforselect='holiday'; $keyforelement='holiday'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'holiday as d'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'holiday_extrafields as extra on d.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_holiday_types as t ON t.rowid = d.fk_type'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua ON ua.rowid = d.fk_validator,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'user as u'; From 9d90b31c20a5f550f14b88e7b48c7b3d3eb95ced Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Sep 2019 12:17:14 +0200 Subject: [PATCH 6/8] css --- htdocs/theme/eldy/global.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 334fbe00ba1..14f13f4f97e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4714,6 +4714,10 @@ div.dataTables_length select { -webkit-box-shadow: none !important; box-shadow: none !important; } +.select2-dropdown { + border: 1px solid #ccc; + box-shadow: 5px 5px 15px #ddd; +} .select2-dropdown-open { background-color: #fff; } @@ -5014,6 +5018,7 @@ dl.dropdown { list-style:none; max-height: 264px; overflow: auto; + border-radius: 2px; } .dropdown dd ul li { white-space: nowrap; From 72f90733377fb42ebdf7453709958ed53662fbf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Sep 2019 12:44:44 +0200 Subject: [PATCH 7/8] Clean vat code samples to have cleaner rules for rowid. --- htdocs/install/mysql/data/llx_c_tva.sql | 220 ++++++++++++------------ 1 file changed, 113 insertions(+), 107 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 26c2acdf308..c0a03c141bf 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -36,36 +36,36 @@ delete from llx_c_tva; -- ARGENTINA (id country=23) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (231, 23, '21','0','IVA standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (231, 23, '0','0','IVA Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (232, 23,'10.5','0','IVA reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (233, 23, '0','0','IVA Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (233, 23, '21','0','IVA standard rate',1); -- AUSTRALIA (id country=28) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (281, 28, '10','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (282, 28, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (281, 28, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (282, 28, '10','0','VAT standard rate',1); -- AUSTRIA (id country=41) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (411, 41, '20','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (411, 41, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (412, 41, '10','0','VAT reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (413, 41, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (413, 41, '20','0','VAT standard rate',1); -- BRASIL (id country=56) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (561, 56, '0','0','VAT reduced rate',1); -- BULGARIA (id country=59) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (591, 59, '20','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (591, 59, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (592, 59, '7','0','VAT reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (593, 59, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (593, 59, '20','0','VAT standard rate',1); -- BELGIUM (id country=2) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 21, 2, '21','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 21, 2, '0','0','VAT Rate 0 ou non applicable',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 22, 2, '6','0','VAT reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 23, 2, '0','0','VAT Rate 0 ou non applicable',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 23, 2, '21','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 24, 2, '12','0','VAT reduced rate', 1); -- CANADA (id country=14) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (141, 14, '7','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (142, 14, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (141, 14, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (142, 14, '7','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Province',1); --insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Quebec',1); --insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (144, 14,'5','0','7','1','GST/TPS and PST/TVQ rate for British Columbia',1); @@ -73,72 +73,73 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ -- CAMEROUN (id country=24) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (241, 24, '19.25','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (242, 24, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (241, 24, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (242, 24, '19.25','0','VAT standard rate',1); -- CHILE (id country=67) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (671, 67, '19','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (672, 67, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (671, 67, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (672, 67, '19','0','VAT standard rate',1); -- CHINA (id country=9) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 91, 9, '17','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 91, 9, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 92, 9, '13','0','VAT reduced rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '17','0','VAT standard rate',1); -- CYPRUS (id country=78) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '19','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT Rate 9',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (783, 78, '5','0','VAT Rate 5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (784, 78, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (784, 78, '19','0','VAT standard rate',1); -- DANMERK (id country=80) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (801, 80, '25','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802, 80, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (801, 80, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802, 80, '25','0','VAT standard rate',1); -- FRANCE (id country=1) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1, '20','0','VAT standard rate (France hors DOM-TOM)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1, '0','0','VAT Rate 0 ou non applicable',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 12, 1, '20','0','VAT standard rate (France hors DOM-TOM)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 13, 1, '10','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT reduced rate (France hors DOM-TOM)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '0','0','VAT Rate 0 ou non applicable',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 16, 1, '2.1','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 17, 1, '10','0','VAT reduced rate',1); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) values (1, '8.5', '85', '0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) values (1, '8.5', '85NPR', '1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active) values (1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '2.1','0','VAT super-reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active) values (16, 1, '8.5', '85', '0', 'VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active) values (17, 1, '8.5', '85NPR', '1', 'VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active) values (18, 1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (19, 1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0); -- GERMANY (id country=5) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19.0','0','allgemeine Ust.',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '0','0','No VAT', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 52, 5, '7.0','0','ermäßigte USt.', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 53, 5, '0.0','0','keine USt.', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 54, 5, '5.5','0','USt. Forst', 0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 55, 5, '10.7','0','USt. Landwirtschaft', 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 56, 5, '19.0','0','allgemeine Ust.',1); -- GREECE (id country=102) -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2462, 102, 24, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2463, 102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2464, 102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2465, 102, 6.5, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2466, 102, 16, 0, '0', 0, '0', 0, 'Νήσων κανονικός Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2467, 102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (2468, 102, 5, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1021, 102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1022, 102, 24, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1023, 102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1024, 102, 6.5, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1025, 102, 16, 0, '0', 0, '0', 0, 'Νήσων κανονικός Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1026, 102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1027, 102, 5, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1); -- ICELAND (id country=116) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1161, 116,'25.5','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1161, 116, '0','0','VAT rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1163, 116,'25.5','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1162, 116, '7','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1163, 116, '0','0','VAT rate 0',1); -- INDIA (id country=117) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '0','0','VAT Rate 0', 0); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1178, 117, 'C+S-5', 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1180, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1181, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1172, 117, 'C+S-5' , 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1173, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1174, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1175, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1); insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1182, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1183, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1178, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1); -- IRELAND (id country=8) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 81, 8, '0','0','VAT Rate 0',1); @@ -148,165 +149,165 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 8 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 85, 8, '4.8','0','VAT reduced rate',1); -- ITALY (id country=3) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 31, 3, '22','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 31, 3, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 32, 3, '10','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 33, 3, '4','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '22','0','VAT standard rate',1); -- IVORY COST (id country=21) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1); -- JAPAN (id country=123) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1231, 123, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1232, 123, '5','0','VAT Rate 5',1); -- LUXEMBOURG (id country=140) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1401, 140, '17','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1401, 140, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1402, 140, '14','0','VAT intermediary rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1403, 140, '8','0','VAT reduced rate', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1404, 140, '3','0','VAT super-reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '17','0','VAT standard rate',1); -- MONACO (id country=27) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27,'19.6','0','VAT standard rate (France hors DOM-TOM)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27, '0','0','VAT Rate 0 ou non applicable',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 272, 27, '8.5','0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 273, 27, '8.5','1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 274, 27, '5.5','0','VAT reduced rate (France hors DOM-TOM)',0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 275, 27, '0','0','VAT Rate 0 ou non applicable',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 275, 27,'19.6','0','VAT standard rate (France hors DOM-TOM)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 276, 27, '2.1','0','VAT super-reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 277, 27, '7','0','VAT reduced rate',1); -- MAROCO (id country=12) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 121, 12, '20','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 121, 12, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 122, 12, '14','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 123, 12, '10','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 124, 12, '7','0','VAT super-reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 125, 12, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 125, 12, '20','0','VAT standard rate',1); -- MALTA (id country=148) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1481, 148, '18','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1481, 148, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1482, 148, '7','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1483, 148, '5','0','VAT super-reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1484, 148, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1484, 148, '18','0','VAT standard rate',1); -- NEDERLAND (id country=17) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 171, 17, '19','0','Algemeen BTW tarief',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 171, 17, '0','0','0 BTW tarief', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 172, 17, '6','0','Verlaagd BTW tarief', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 173, 17, '0','0','0 BTW tarief', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 173, 17, '19','0','Algemeen BTW tarief',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 174, 17, '21','0','Algemeen BTW tarief (vanaf 1 oktober 2012)',0); -- NEW ZEALAND (id country=166) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1661, 166, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1662, 166, '15','0','VAT standard rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1663, 166, '0','0','VAT Rate 0', 1); -- NIGERIA (id country=169) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1691, 169, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1692, 169, '5','0','VAT standard rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1693, 169, '0','0','VAT Rate 0', 1); -- NORWAY (id country=173) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1731, 173, '25','0','VAT standard rate', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1731, 173, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1732, 173, '14','0','VAT reduced rate', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1733, 173, '8','0','VAT reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1734, 173, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1734, 173, '25','0','VAT standard rate', 1); -- PANAMA (id country=178) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1781, 178, '7','0','ITBMS standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1782, 178, '0','0','ITBMS Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1781, 178, '0','0','ITBMS Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1782, 178, '7','0','ITBMS standard rate',1); -- PERU (id country=181) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1811, 181, '18','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1812, 181, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1811, 181, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1818, 181, '18','0','VAT standard rate',1); -- POLAND (id country=184) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1841, 184, '23','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1841, 184, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1842, 184, '8','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1843, 184, '3','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1844, 184, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1844, 184, '23','0','VAT standard rate',1); -- PORTUGAL (id country=25) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 251, 25, '23','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 251, 25, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 252, 25, '13','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 253, 25, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 253, 25, '23','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 254, 25, '6','0','VAT reduced rate',1); -- ROMANIA (id country=188) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1881, 188, '19','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1881, 188, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1882, 188, '9','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1883, 188, '19','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1884, 188, '5','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1883, 188, '0','0','VAT Rate 0', 1); -- SAUDI ARABIA (id country=26) INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 261, 26, '0', '0', 'VAT Rate 0', 1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 262, 26, '5', '0', 'VAT Rate 5', 1); -- SAN SALVADOR (id country=86) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 861, 86, '13', '0', 'IVA 13', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 862, 86, '0', '0', 'SIN IVA', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 861, 86, '0', '0', 'SIN IVA', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 862, 86, '13', '0', 'IVA 13', 1); -- SENEGAL (id country=22) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 221, 22, '18', '0', 'VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 221, 22, '0', '0', 'VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 222, 22, '10', '0', 'VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 223, 22, '0', '0', 'VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 223, 22, '18', '0', 'VAT standard rate',1); -- SLOVAKIA (id country=201) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2011, 201, '19', '0', 'VAT standard rate', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2011, 201, '0', '0', 'VAT Rate 0', 1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2012, 201, '10', '0', 'VAT reduced rate', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2013, 201, '0', '0', 'VAT Rate 0', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2013, 201, '19', '0', 'VAT standard rate', 1); -- SLOVENIA (id country=202) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2021, 202, '22', '0', 'VAT standard rate', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2021, 202, '0', '0', 'VAT Rate 0', 1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2022, 202,'9.5', '0', 'VAT reduced rate', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '22', '0', 'VAT standard rate', 1); -- SOUTH AFRICA (id country=205) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051, 205, '15', '0', 'VAT standard rate', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2053, 205, '0', '0', 'VAT Rate 0', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051, 205, '0', '0', 'VAT Rate 0', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052, 205, '15', '0', 'VAT standard rate', 1); -- SPAIN (id country=4) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-19:-15:-9','5','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4, '0','0', '0','3','-19:-15:-9','5','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-19:-15:-9','5','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-19:-15:-9','5','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-19:-15:-9','5','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4,'21','0','5.2','3','-19:-15:-9','5','VAT standard rate',1); -- SWEDEN (id country=20) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 201, 20, '25','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 201, 20, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 202, 20, '12','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 203, 20, '6','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 204, 20, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 204, 20, '25','0','VAT standard rate',1); -- SWITZERLAND (id country=6) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '7.7','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.7','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.5','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '7.7','0','VAT standard rate',1); -- SRI LANKA (id country=207) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2071, 207, '0','0','VAT 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2072, 207, '15','0','VAT 15%', 1); -- TAIWAN (id country=213) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2131, 213, '5','0','VAT 5%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2132, 213, '0','0','VAT 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2131, 213, '0','0','VAT 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2132, 213, '5','0','VAT 5%',1); -- TUNISIA (id country=10) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (101,10, '6','0','VAT 6%', 1, 1, '4', 0, 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (101,10, '0','0','VAT Rate 0', 1, 1, '4', 0, 0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (102,10, '12','0','VAT 12%',1, 1, '4', 0, 0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (103,10, '18','0','VAT 18%',1, 1, '4', 0, 0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1, 1, '4', 0, 0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1, 1, '4', 0, 0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10, '0','0','VAT Rate 0', 1, 1, '4', 0, 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10, '6','0','VAT 6%', 1, 1, '4', 0, 0); -- UKRAINE (id country=226) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '20','0','VAT standart rate',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2262,226, '0','0','VAT Rate 0',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '0','0','VAT Rate 0',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2262,226, '20','0','VAT standart rate',1); -- UNITED OF KINGDOM (id country=7) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 71, 7, '20','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 71, 7, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 72, 7, '17.5','0','VAT standard rate before 2011',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 73, 7, '5','0','VAT reduced rate', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 74, 7, '0','0','VAT Rate 0', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 74, 7, '20','0','VAT standard rate',1); -- UNITED STATES (id country=11) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1); @@ -325,35 +326,40 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (24 -- MAURITANIA (id country=151) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1511,151, '0','0','VAT Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1512,151, '14','0','VAT Rate 14',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1512,151, '14','0','VAT Rate 14',1); -- MAURITIUS (id country=152) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1521,152, '0','0','VAT Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1522,152, '15','0','VAT Rate 15',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1522,152, '15','0','VAT Rate 15',1); -- HONDURAS (id country=114) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1141,114, '0','0','No ISV',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1142,114, '12','0','ISV 12%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1142,114, '12','0','ISV 12%',1); -- MEXIQUE (id country=154) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1541,154, '0','0','No VAT',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1542,154, '16','0','VAT 16%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1543,154, '10','0','VAT Frontero',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1542,154, '16','0','VAT 16%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1543,154, '10','0','VAT Frontero',1); -- BARBADOS (id country=46) INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 461, 46, '0','0','No VAT',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1); -- SOUTH AFRICA (id country=205) INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051,205, '0','0','No VAT',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052,205, '14','0','VAT 14%',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052,205, '14','0','VAT 14%',1); -- VENEZUELA (id country=232) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1); +-- Example of code to insert a vat rate 0 for each country +--delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1') +--insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva); + + From 2e1decc57e7db91b4a262d495e25352dc85f18c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Sep 2019 17:41:37 +0200 Subject: [PATCH 8/8] Use css instead of hard coded style --- htdocs/takepos/css/pos.css | 8 ++++++++ htdocs/takepos/pay.php | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 041f4f56bee..71ad5b61362 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -129,6 +129,14 @@ table.postablelines tr td { height: 40px !important; } +div.paymentbordline +{ + width:50%; + background-color:#666; + border-radius: 8px; + margin-bottom: 4px; +} + @media only screen and (max-aspect-ratio: 6/4) { div.description{ min-height:20%; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 9fd19b7378f..aa75ed5a2c4 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -181,18 +181,18 @@ else print "var received=0;";
-
+
trans('TotalTTC');?>: total_ttc, 1, '', 1, -1, -1) ?>
total_ttc) { ?> -
+
trans('RemainToPay');?>:
-
+
trans("Received"); ?>:
-
+
trans("Change"); ?>: