From 77490bff713824d7d7ccecf7dc2d41dad52b3c51 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Mon, 29 Feb 2016 10:07:48 +0100 Subject: [PATCH 01/22] FIX: Status filter don't work --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index a02f2f78440..8704e781a30 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -304,7 +304,7 @@ if ($resql) print ''; print ''; $liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid")); - print $form->selectarray('filtre', $liststatus, $search_status, 1); + print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; print ''; print ''; From 10d04e63c1c1a59df280c6ee1dc33ec873dde6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 29 Feb 2016 22:59:08 +0100 Subject: [PATCH 02/22] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 3f813e00938..62a2b01dd58 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1261,6 +1261,7 @@ class BonPrelevement extends CommonObject $dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S'); $fileDebiteurSection = ''; $fileEmetteurSection = ''; + $ListOfFactures = ''; $i = 0; $j = 0; $this->total = 0; @@ -1277,7 +1278,7 @@ class BonPrelevement extends CommonObject while ($j < $num) { $objfac = $this->db->fetch_object($resql); - $ListOfFactures = $ListOfFactures . $objfac->fac . ","; + $ListOfFactures .= ($j>0?',':'') . $objfac->fac; $j++; } } From e63ab857d8b91af98664768b3a43b1cb0cdec621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 11:21:56 +0100 Subject: [PATCH 03/22] FIX #4583 Incorrect call of Categories::containing throws a DoliDB error Close #4583 --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 18f13a44813..e1e44a475ed 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1241,7 +1241,7 @@ class Categorie extends CommonObject $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; - $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type]; + $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type]; $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; $res = $this->db->query($sql); From 123d6fb6e57730ab0ac33d69d0e2664de7f501ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 11:29:42 +0100 Subject: [PATCH 04/22] FIX #4425 Missing "VAT" translation in supplier order popup Close #4425 --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7685c715494..e7777f82cd5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -583,7 +583,7 @@ class CommandeFournisseur extends CommonOrder if (! empty($this->total_ht)) $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); From aa457346835b3fb0379b875882c47dfed387cae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 11:38:40 +0100 Subject: [PATCH 05/22] FIX #4434 Weird behaviour when enabling multiprices Close #4434 --- htdocs/product/admin/product.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index c188fb94973..b8c07df87a5 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -56,7 +56,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } // Clean param -if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) $conf->global->PRODUIT_MULTIPRICES_LIMIT = 5; +if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) { + dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity); +} From 7d336bd5d4ada8f0d89b0f6bcdd5f4b878c92914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 11:43:55 +0100 Subject: [PATCH 06/22] FIX #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property Close #4414 --- htdocs/fourn/facture/card.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1919faadee4..c2b2c587736 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1577,12 +1577,6 @@ else if ($objectref == 'PROV') { $savdate=$object->date; - if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) - { - $object->date=dol_now(); - //TODO: Possibly will have to control payment information into suppliers - //$object->date_lim_reglement=$object->calculate_date_lim_reglement(); - } $numref = $object->getNextNumRef($societe); } else From 6f5481896b7d0926fc4a669cdce84d24f71a0545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Mar 2016 12:38:34 +0100 Subject: [PATCH 07/22] FIX #4453 SEPA Direct Debit generated XML shows a trailing comma in RmtInf field Close #4453 --- .../prelevement/class/bonprelevement.class.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 62a2b01dd58..610fe257732 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1261,28 +1261,25 @@ class BonPrelevement extends CommonObject $dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S'); $fileDebiteurSection = ''; $fileEmetteurSection = ''; - $ListOfFactures = ''; $i = 0; - $j = 0; $this->total = 0; /* * section Debiteur (sepa Debiteurs bloc lines) */ + $tmp_invoices = array(); + $sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1"; $resql=$this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - while ($j < $num) - { - $objfac = $this->db->fetch_object($resql); - $ListOfFactures .= ($j>0?',':'') . $objfac->fac; - $j++; + if ($resql) { + while ($objfac = $this->db->fetch_object($resql)) { + $tmp_invoices[] = $objfac->fac; } } + $ListOfFactures = implode($tmp_invoices); + $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; $sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; From 59c4559a781238ac5f6c78507812ef42a9483d8c Mon Sep 17 00:00:00 2001 From: philippe grand Date: Wed, 2 Mar 2016 21:13:12 +0100 Subject: [PATCH 08/22] fix : missing translation --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cfb5e9644be..8b1643f84a6 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -783,6 +783,7 @@ Permission2403=Delete actions (events or tasks) linked to his account Permission2411=Read actions (events or tasks) of others Permission2412=Create/modify actions (events or tasks) of others Permission2413=Delete actions (events or tasks) of others +Permission2414=Export actions/tasks of others Permission2501=Read/Download documents Permission2502=Download documents Permission2503=Submit or delete documents From 6fd533481225ce81d6ccfc862d2d70961a66e94e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 3 Mar 2016 10:10:55 +0100 Subject: [PATCH 09/22] Fix: compatibility with multicompany transversal mode and more security issue --- htdocs/societe/commerciaux.php | 40 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 498257ea496..245626752e4 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -33,7 +33,7 @@ $langs->load("suppliers"); $langs->load("banks"); // Security check -$socid = isset($_GET["socid"])?$_GET["socid"]:''; +$socid = GETPOST('socid', 'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe','',''); @@ -43,7 +43,7 @@ $hookmanager->initHooks(array('salesrepresentativescard','globalcard')); * Actions */ -if($_GET["socid"] && $_GET["commid"]) +if (! empty($socid) && $_GET["commid"]) { $action = 'add'; @@ -51,8 +51,8 @@ if($_GET["socid"] && $_GET["commid"]) { $soc = new Societe($db); - $soc->id = $_GET["socid"]; - $soc->fetch($_GET["socid"]); + $soc->id = $socid; + $soc->fetch($socid); $parameters=array('id'=>$_GET["commid"]); @@ -61,17 +61,17 @@ if($_GET["socid"] && $_GET["commid"]) if (empty($reshook)) $soc->add_commercial($user, $_GET["commid"]); - header("Location: commerciaux.php?socid=".$soc->id); + header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$soc->id); exit; } else { - header("Location: commerciaux.php?socid=".$_GET["socid"]); + header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } } -if($_GET["socid"] && $_GET["delcommid"]) +if (! empty($socid) && $_GET["delcommid"]) { $action = 'delete'; @@ -87,12 +87,12 @@ if($_GET["socid"] && $_GET["delcommid"]) if (empty($reshook)) $soc->del_commercial($user, $_GET["delcommid"]); - header("Location: commerciaux.php?socid=".$soc->id); + header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$soc->id); exit; } else { - header("Location: commerciaux.php?socid=".$_GET["socid"]); + header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } } @@ -107,11 +107,11 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url); $form = new Form($db); -if ($_GET["socid"]) +if (! empty($socid)) { $soc = new Societe($db); - $soc->id = $_GET["socid"]; - $result=$soc->fetch($_GET["socid"]); + $soc->id = $socid; + $result=$soc->fetch($socid); $action='view'; @@ -190,7 +190,7 @@ if ($_GET["socid"]) print ' '; if ($user->rights->societe->creer) { - print ''; + print ''; print img_delete(); print ''; } @@ -222,9 +222,17 @@ if ($_GET["socid"]) $langs->load("users"); $title=$langs->trans("ListOfUsers"); - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.login"; + $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + { + $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql.= " WHERE (ug.fk_user = u.rowid"; + $sql.= " AND ug.entity = ".$conf->entity.")"; + $sql.= " OR u.admin = 1"; + } + else + $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut<>0 "; $sql.= " ORDER BY u.lastname ASC "; @@ -256,7 +264,7 @@ if ($_GET["socid"]) print dolGetFirstLastname($obj->firstname, $obj->lastname)."\n"; print ''; print ''.$obj->login.''; - print ''.$langs->trans("Add").''; + print ''.$langs->trans("Add").''; print ''."\n"; $i++; From 9e80a3794736a219fa8c197481896364e80d01a2 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 3 Mar 2016 15:45:42 +0100 Subject: [PATCH 10/22] fix : missing translation --- htdocs/langs/fr_FR/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d566f1d3677..48bcac3abdc 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1660,7 +1660,7 @@ NotSupportedByAllThemes=Fonctionne avec le thème eldy mais n'est pas pris en ch BackgroundColor=Couleur de fond TopMenuBackgroundColor=Couleur de fond pour le menu Gauche LeftMenuBackgroundColor=Couleur de fond pour le menu Gauche -BackgroundTableTitleColor=Background color for Table title line +BackgroundTableTitleColor=Couleur de fond pour les titres des lignes des tables BackgroundTableLineOddColor=Couleur de fond pour les lignes impaires des tables BackgroundTableLineEvenColor=Couleur de fond pour les lignes paires des tales MinimumNoticePeriod=Période de préavis minimum (Votre demande de congé doit être faite avant ce délai) From 74601a0b1d0911445b0bb3593f1b8afff0232a96 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 3 Mar 2016 16:01:50 +0100 Subject: [PATCH 11/22] fix : missing translation --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8b1643f84a6..55e43d390f1 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -635,6 +635,7 @@ Permission162=Create/modify contracts/subscriptions Permission163=Activate a service/subscription of a contract Permission164=Disable a service/subscription of a contract Permission165=Delete contracts/subscriptions +Permission167=Export contracts Permission171=Read trips and expenses (yours and your subordinates) Permission172=Create/modify trips and expenses Permission173=Delete trips and expenses From 4a3509d35022bed3a9fb6dc53a2c4935e78f19b1 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 3 Mar 2016 16:09:19 +0100 Subject: [PATCH 12/22] fix : missing translation --- htdocs/langs/fr_FR/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 48bcac3abdc..0837c240c9e 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -772,8 +772,8 @@ Permission20001=Lire les demandes de congé (les vôtres et celle de vos subordo Permission20002=Créer/modifier vos demandes de congé Permission20003=Supprimer les demandes de congé Permission20004=Lire toutes les demandes de congé (même celle des utilisateurs non subordonnés) -Permission20005=Create/modify leave requests for everybody -Permission20006=Admin leave requests (setup and update balance) +Permission20005=Créer/modifier les congés pour tout le monde +Permission20006=Administration des demandes de congés (configuration et mise à jour du solde) Permission23001=Voir les travaux planifiés Permission23002=Créer/Modifier des travaux planifiées Permission23003=Effacer travail planifié From 6851c3fdb059f4558f3d580ed10759b5ab596650 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 3 Mar 2016 16:18:07 +0100 Subject: [PATCH 13/22] fix : missing translation --- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 55e43d390f1..2a8b4b717b1 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -582,6 +582,7 @@ Permission38=Export products Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet) Permission42=Create/modify projects (shared project and projects i'm contact for) Permission44=Delete projects (shared project and projects i'm contact for) +Permission45=Export projects Permission61=Read interventions Permission62=Create/modify interventions Permission64=Delete interventions diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 0837c240c9e..c58c9e3b0ec 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -583,6 +583,7 @@ Permission38=Exporter les produits Permission41=Lire les projets et les tâches (projets publiques et projets dont je suis contact). Peut également entrer le temps consommé sur les tâches assignées (feuille de temps) Permission42=Créer/modifier les projets et tâches (partagés ou dont je suis contact) Permission44=Supprimer les projets et tâches (partagés ou dont je suis contact) +Permission45=Exporter les projets Permission61=Consulter les interventions Permission62=Créer/modifier les interventions Permission64=Supprimer les interventions From 09a9546c14fa8bf2933ad1fb9bfb9a52934b1391 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Mar 2016 20:41:56 +0100 Subject: [PATCH 14/22] FIX Can not disabled an opened service line in a contract --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9e0ed827ba8..3fe0530ec77 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1643,7 +1643,7 @@ else { $tmpaction='activateline'; if ($objp->statut == 4) $tmpaction='unactivateline'; - if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->unactiver)) { + if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) { print ''; print img_edit(); print ''; From f9d8aba32568ac52a6478966c372230bcae5c43e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Mar 2016 11:48:46 +0100 Subject: [PATCH 15/22] Fix: wrong modelpdf var name --- htdocs/fichinter/card.php | 42 ++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 4aab3a99573..bada34e924c 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -116,17 +116,20 @@ if (empty($reshook)) if ($result >= 0) { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; @@ -142,17 +145,20 @@ if (empty($reshook)) $result = $object->setDraft($user); if ($result >= 0) { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; From e03f4b4de98e426046f55cd726f7414ab2ba799e Mon Sep 17 00:00:00 2001 From: phf Date: Fri, 4 Mar 2016 12:21:14 +0100 Subject: [PATCH 16/22] Fix can't send mail to thirdparty contact if no mail defined on thirdparty card --- htdocs/societe/soc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 4bad452110b..76a2c948636 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2366,7 +2366,18 @@ else $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if (! empty($object->email)) + $at_least_one_email_contact = false; + $TContact = $object->contact_array_objects(); + foreach ($TContact as &$contact) + { + if (!empty($contact->email)) + { + $at_least_one_email_contact = true; + break; + } + } + + if (! empty($object->email) || $at_least_one_email_contact) { $langs->load("mails"); print ''; From 967ae720ef5671db991b0d3f829696d444100dab Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Mar 2016 15:51:34 +0100 Subject: [PATCH 17/22] Fix: compatibility with multicompany transversal mode --- htdocs/societe/class/societe.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 72c93fa4b65..d31a240d2e4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2003 Brian Fraval * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Florian Henry @@ -1660,10 +1660,19 @@ class Societe extends CommonObject $reparray=array(); - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.email"; + $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.email"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.rowid = sc.fk_user AND sc.fk_soc =".$this->id; - $sql.= " AND entity in (0, ".$conf->entity.")"; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + { + $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql.= " WHERE (ug.fk_user = u.rowid"; + $sql.= " AND ug.entity = ".$conf->entity.")"; + $sql.= " OR u.admin = 1"; + } + else + $sql.= " WHERE entity in (0, ".$conf->entity.")"; + + $sql.= " AND u.rowid = sc.fk_user AND sc.fk_soc =".$this->id; $resql = $this->db->query($sql); if ($resql) From bd0320dea08263c5ea5b8ff806e26f892d4891ff Mon Sep 17 00:00:00 2001 From: philippe grand Date: Fri, 4 Mar 2016 16:30:47 +0100 Subject: [PATCH 18/22] fix : missing traduction --- htdocs/langs/fr_FR/products.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 455cb209986..ff46a83bbf2 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -240,8 +240,8 @@ ProductUsedForBuild=Consommé automatiquement par la fabrication ProductBuilded=Fabrication terminée ProductsMultiPrice=Produits multi-prix ProductsOrServiceMultiPrice=Prix clients (des produits ou services, multi-prix) -ProductSellByQuarterHT=Products turnover quarterly before tax -ServiceSellByQuarterHT=Services turnover quarterly before tax +ProductSellByQuarterHT=Chiffre d'affaires trimestriel des produits hors taxes +ServiceSellByQuarterHT=Chiffre d'affaires trimestriel des services hors taxes Quarter1=1er trimestre Quarter2=2eme trimestre Quarter3=3eme trimestre From 735a1c075edfddeb6709c3705a07bc15495cc58b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Mar 2016 16:48:53 +0100 Subject: [PATCH 19/22] Fix: best sql request --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d31a240d2e4..864820602c8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1665,9 +1665,9 @@ class Societe extends CommonObject if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) { $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql.= " WHERE (ug.fk_user = u.rowid"; + $sql.= " WHERE ((ug.fk_user = sc.fk_user"; $sql.= " AND ug.entity = ".$conf->entity.")"; - $sql.= " OR u.admin = 1"; + $sql.= " OR u.admin = 1)"; } else $sql.= " WHERE entity in (0, ".$conf->entity.")"; From 5292920a84ccb06ad71c8c717bf508cb695e95bd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Mar 2016 17:10:42 +0100 Subject: [PATCH 20/22] Fix: don't see the sales representative of anothers entities --- htdocs/societe/commerciaux.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 245626752e4..436dfc5926c 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -160,12 +160,24 @@ if (! empty($socid)) print ''.$langs->trans("SalesRepresentatives").''; print ''; - $sql = "SELECT u.rowid, u.lastname, u.firstname"; + $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE sc.fk_soc =".$soc->id; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql .= " WHERE sc.fk_soc = ".$soc->id; $sql .= " AND sc.fk_user = u.rowid"; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + { + $sql.= " AND ((ug.fk_user = sc.fk_user"; + $sql.= " AND ug.entity = ".$conf->entity.")"; + $sql.= " OR u.admin = 1)"; + } + else + $sql.= " AND u.entity IN (0,".$conf->entity.")"; + $sql .= " ORDER BY u.lastname ASC "; + dol_syslog('societe/commerciaux.php::list salesman sql = '.$sql,LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -227,9 +239,9 @@ if (! empty($socid)) if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) { $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql.= " WHERE (ug.fk_user = u.rowid"; + $sql.= " WHERE ((ug.fk_user = u.rowid"; $sql.= " AND ug.entity = ".$conf->entity.")"; - $sql.= " OR u.admin = 1"; + $sql.= " OR u.admin = 1)"; } else $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; From 210d8435daaafa5678f1c2c83abc0345c867912a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Mar 2016 00:39:13 +0100 Subject: [PATCH 21/22] FIX The part added with hidden option MAIN_DOC_USE_TIMING was included with a . instead of -. This make os think it is part of extension instead of file name. --- .../doc/doc_generic_askpricesupplier_odt.modules.php | 4 +++- .../modules/commande/doc/doc_generic_order_odt.modules.php | 4 +++- .../expedition/doc/doc_generic_shipment_odt.modules.php | 4 +++- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 4 +++- .../modules/project/doc/doc_generic_project_odt.modules.php | 4 +++- .../modules/propale/doc/doc_generic_proposal_odt.modules.php | 4 +++- htdocs/core/modules/societe/doc/doc_generic_odt.modules.php | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php b/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php index ddc995cc69a..49b0fdb69a3 100644 --- a/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php +++ b/htdocs/core/modules/askpricesupplier/doc/doc_generic_askpricesupplier_odt.modules.php @@ -273,7 +273,9 @@ class doc_generic_askpricesupplier_odt extends ModelePDFAskPriceSupplier $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1b7da875073..27a98eff1d8 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -239,7 +239,9 @@ class doc_generic_order_odt extends ModelePDFCommandes $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index aaddbc1d748..b482d3a0abe 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -239,7 +239,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 2ca90b13ace..2e45342c244 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -240,7 +240,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 6e2601797f8..d42127a23ed 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -449,7 +449,9 @@ class doc_generic_project_odt extends ModelePDFProjects $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 8f79094befc..44961120bb5 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -273,7 +273,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 90ced6322b7..8d7a2faf261 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -211,7 +211,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc $newfileformat=substr($newfile, strrpos($newfile, '.')+1); if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { - $filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat; + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; } else { From 896f60a4786a7f1e71253620d35398589011be68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Mar 2016 00:47:00 +0100 Subject: [PATCH 22/22] hidden solution to solve files overwriting each other --- htdocs/core/modules/societe/doc/doc_generic_odt.modules.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 8d7a2faf261..89ecf7075c5 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -209,6 +209,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); // Get extension (ods or odt) $newfileformat=substr($newfile, strrpos($newfile, '.')+1); + if ( ! empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME)) + { + $newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp; + } if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) { $format=$conf->global->MAIN_DOC_USE_TIMING;