From 56d6510472c07ae5af598c77a60d3e3544243bd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2016 18:35:15 +0200 Subject: [PATCH 1/7] Fix Quick hack to solve legal problem in some countries. --- htdocs/compta/facture.php | 194 ++++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 92 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8586a5d77a5..63d87cfba31 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2190,31 +2190,34 @@ if ($action == 'create') if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - print '
'; - $tmp=' '; - print ''; - - $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); - print ''; - if (($origin == 'propal') || ($origin == 'commande')) - { - print ''; - print '
'; - print $desc; - print ''; - $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); - print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); - print '' . $langs->trans('Value') . ':'; - } - print '
'; - - print '
'; + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + { + print '
'; + $tmp=' '; + print ''; + + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); + print ''; + if (($origin == 'propal') || ($origin == 'commande')) + { + print ''; + print '
'; + print $desc; + print ''; + $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); + print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); + print '' . $langs->trans('Value') . ':'; + } + print '
'; + + print '
'; + } } if ($socid > 0) @@ -2244,32 +2247,36 @@ if ($action == 'create') } // Replacement - print '
'; - $tmp=' - jQuery(document).ready(function() { - jQuery("#fac_replacement").change(function() { - jQuery("#radio_replacement").prop("checked", true); - }); - }); - '; - $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; - $text .= ' + jQuery(document).ready(function() { + jQuery("#fac_replacement").change(function() { + jQuery("#radio_replacement").prop("checked", true); + }); + }); + '; + $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; } - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); - print $desc; - print ''; } else { @@ -2286,48 +2293,51 @@ if ($action == 'create') { if ($socid > 0) { - // Credit note - print '
'; - $tmp=' - jQuery(document).ready(function() { - if (! jQuery("#radio_creditnote").is(":checked")) - { - jQuery("#credit_note_options").hide(); - } - jQuery("#radio_creditnote").click(function() { - jQuery("#credit_note_options").show(); - }); - jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() { - jQuery("#credit_note_options").hide(); - }); - }); - '; - $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; - // $text.=''; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); - print $desc; - - print '
'; - print '    0 ? 'checked':'').' /> "; - print '
    0 ? 'checked':'').' /> "; - print '
'; - - print '
'; + // Credit note + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + { + print '
'; + $tmp=' + jQuery(document).ready(function() { + if (! jQuery("#radio_creditnote").is(":checked")) + { + jQuery("#credit_note_options").hide(); + } + jQuery("#radio_creditnote").click(function() { + jQuery("#credit_note_options").show(); + }); + jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() { + jQuery("#credit_note_options").hide(); + }); + }); + '; + $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; + // $text.=''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + print $desc; + + print '
'; + print '    0 ? 'checked':'').' /> "; + print '
    0 ? 'checked':'').' /> "; + print '
'; + + print '
'; + } } else { From f04a3bf0c800f38213ae5613e613fff2df0ef8e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2016 18:46:47 +0200 Subject: [PATCH 2/7] Fix sql error --- htdocs/hrm/establishment/card.php | 7 ++++++- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 4 ++++ htdocs/install/mysql/tables/llx_establishment.sql | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 11179d218f8..9917113ff39 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -48,6 +48,10 @@ foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($va $object = new Establishment($db); +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once + + /* * Actions */ @@ -128,7 +132,8 @@ else if ($action == 'update') $error ++; } - if (empty($error)) { + if (empty($error)) + { $object->name = GETPOST('name', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 1309c1dc225..cbc0dd75a56 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -537,3 +537,7 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17804', 'Sociedad Civil', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17805', 'Sociedad AnĂ³nima', 1); + +-- VMYSQL4.1 ALTER TABLE llx_establishment CHANGE COLUMN fk_user_mod fk_user_mod integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_establishment ALTER COLUMN fk_user_mod DROP NOT NULL; + diff --git a/htdocs/install/mysql/tables/llx_establishment.sql b/htdocs/install/mysql/tables/llx_establishment.sql index fcf57ac28b6..667d512762d 100644 --- a/htdocs/install/mysql/tables/llx_establishment.sql +++ b/htdocs/install/mysql/tables/llx_establishment.sql @@ -33,7 +33,7 @@ CREATE TABLE llx_establishment ( profid3 varchar(20), phone varchar(20), fk_user_author integer NOT NULL, - fk_user_mod integer NOT NULL, + fk_user_mod integer, datec datetime NOT NULL, tms timestamp NOT NULL, status tinyint DEFAULT 1 From 1360372a3cdd5b6aa4f62e743f33692e3d0e6194 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2016 18:57:27 +0200 Subject: [PATCH 3/7] Fix hrm module --- htdocs/hrm/admin/admin_establishment.php | 5 +++-- htdocs/hrm/class/establishment.class.php | 22 +++++++++++----------- htdocs/hrm/establishment/card.php | 9 +++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 5f004f15e09..25c2fbf24c7 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -110,7 +110,8 @@ if ($result) $establishmentstatic->id=$obj->rowid; $establishmentstatic->name=$obj->name; - + $establishmentstatic->status=$obj->status; + $var=!$var; print ''; print ''.$establishmentstatic->getNomUrl(1).''; @@ -119,7 +120,7 @@ if ($result) print ''.$obj->town.''; print ''; - print $establishmenttmp->getLibStatus(5); + print $establishmentstatic->getLibStatus(5); print ''; print "\n"; diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 88b765740ef..9ff2e2065cc 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -58,8 +58,8 @@ class Establishment extends CommonObject { $this->db = $db; - $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); - $this->statuts = array(0 => 'Opened', 1 => 'Closed'); + $this->statuts_short = array(0 => 'Closed', 1 => 'Opened'); + $this->statuts = array(0 => 'Closed', 1 => 'Opened'); return 1; } @@ -157,7 +157,7 @@ class Establishment extends CommonObject $sql .= ", address = '".$this->address."'"; $sql .= ", zip = '".$this->zip."'"; $sql .= ", town = '".$this->town."'"; - + $sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null'); $sql .= ", status = '".$this->status."'"; $sql .= ", fk_user_mod = " . $user->id; $sql .= " WHERE rowid = ".$this->id; @@ -273,23 +273,23 @@ class Establishment extends CommonObject } if ($mode == 2) { - if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]); - if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts_short[$status]); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts_short[$status]); + if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]); } if ($mode == 3) { - if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4'); - if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8'); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5'); + if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4'); } if ($mode == 4) { - if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]); - if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts[$status]); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts[$status]); + if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]); } if ($mode == 5) { - if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4'); - if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut8'); + if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); + if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4'); } } diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 9917113ff39..eafa302886f 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -40,8 +40,8 @@ $id = GETPOST('id','int'); // List of status static $tmpstatus2label=array( - '0'=>'OpenEtablishment', - '1'=>'CloseEtablishment' + '0'=>'CloseEtablishment', + '1'=>'OpenEtablishment' ); $status2label=array(''); foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val); @@ -138,7 +138,7 @@ else if ($action == 'update') $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); - $object->country_id = $_POST["country_id"]; + $object->country_id = GETPOST('country_id', 'int'); $object->fk_user_mod = $user->id; $result = $object->update($user); @@ -378,7 +378,8 @@ else if ($id) print ''; // Status - print ''.$langs->trans("Status").''.$object->getLibStatus(4).''; + print ''.$langs->trans("Status").''; + print $object->getLibStatus(4).''; print ""; From 292993c14f028b783b4c86d04bb5b274e8301802 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2016 19:37:34 +0200 Subject: [PATCH 4/7] Fix var $conf not defined --- htdocs/compta/prelevement/class/bonprelevement.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a49b5f5f7c6..924d8092485 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1680,8 +1680,9 @@ class BonPrelevement extends CommonObject * @return string String with SEPA Sender */ function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') - { // SEPA INITIALISATION - global $confs; + { + // SEPA INITIALISATION + global $conf; $dateTime_YMD = dol_print_date($ladate, '%Y%m%d'); $dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d'); From ec5bd2a8f80e3df5c6dd53be5c517289e4d1f552 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2016 00:40:48 +0200 Subject: [PATCH 5/7] Fix button create contract from order not visible sometimes --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 8409eb47e9e..1fcab20500f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2513,7 +2513,7 @@ if ($action == 'create' && $user->rights->commande->creer) } // Create contract - if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) { + if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED || $object->statut == Commande::STATUS_CLOSED)) { $langs->load("contracts"); if ($user->rights->contrat->creer) { From bf7a6380c90dcb8e80e61552fe82c16da763ea47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2016 01:00:28 +0200 Subject: [PATCH 6/7] Fix sort on wrong field --- htdocs/core/boxes/box_contracts.php | 8 +++++--- htdocs/langs/en_US/boxes.lang | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 40cc8885f90..fe864e1df16 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -1,6 +1,7 @@ - * Copyright (C) 2015 Frederic France +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,7 +72,8 @@ class box_contracts extends ModeleBoxes $sql.= " AND c.entity = ".$conf->entity; 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 c.date_contrat DESC, c.ref DESC "; + 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); $resql = $db->query($sql); diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 0cd7cac6a6b..98970318e85 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -38,7 +38,7 @@ BoxMyLastBookmarks=My latest %s bookmarks BoxOldestExpiredServices=Oldest active expired services BoxLastExpiredServices=Latest %s oldest contacts with active expired services BoxTitleLastActionsToDo=Latest %s actions to do -BoxTitleLastContracts=Latest %s contracts +BoxTitleLastContracts=Latest %s modified contracts BoxTitleLastModifiedDonations=Latest %s modified donations BoxTitleLastModifiedExpenses=Latest %s modified expense reports BoxGlobalActivity=Global activity (invoices, proposals, orders) From 0961ce2a2c9b38d6f2215b7281a84473e2c86498 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2016 01:08:01 +0200 Subject: [PATCH 7/7] FIX Missing filter on environment --- htdocs/core/boxes/box_services_expired.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 29db63054e5..f2bc86cdac5 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -68,6 +68,7 @@ class box_services_expired extends ModeleBoxes $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.= " 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;