From b3d58e95109b615b9e5471f24fdaa36277bb2902 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 8 Jun 2016 14:36:52 +0200 Subject: [PATCH 001/144] FIX large expense note --- .../expensereport/doc/pdf_standard.modules.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 0731b803ca3..9f405881565 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -313,11 +313,6 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); - // Comments - $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->posxcomment, $curY); - $pdf->writeHTMLCell($this->posxdate-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $object->lines[$i]->comments, 0, 1); - //nexY $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); @@ -325,6 +320,11 @@ class pdf_standard extends ModeleExpenseReport $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + // Comments + $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetXY($this->posxcomment, $curY); + $pdf->writeHTMLCell($this->posxdate-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $object->lines[$i]->comments, 0, 1); + // Date $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxdate, $curY); @@ -562,7 +562,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','B', $default_font_size + 4); $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx,6,$langs->trans("ExpenseReport"), 0, 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx,6,$langs->trans("ExpenseReport"), 0, 'R'); $pdf->SetFont('','', $default_font_size -1); @@ -570,19 +570,19 @@ class pdf_standard extends ModeleExpenseReport $posy+=8; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'R'); // Date start period $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'R'); // Date end period $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'L'); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'R'); // Status Expense Report $posy+=6; From 0d62bd704e7a61d66842a7c91cf3e50a249461f9 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 22 Jun 2016 18:59:51 +0200 Subject: [PATCH 002/144] Fix: Bad column totalizing if MAIN_SHOW_HT_ON_SUMMARY activated --- htdocs/compta/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 37999567738..913942fc788 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -824,7 +824,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; $total_ttc += $obj->total_ttc; - $total += $obj->total; + $total += $obj->total_ht; $totalam += $obj->am; $var=!$var; $i++; From 3690d11ca28a1d1a368fddbf00976f44a22d3443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Jun 2016 10:48:52 +0200 Subject: [PATCH 003/144] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 09c8acb5b38..fb886e97eb6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -318,15 +318,15 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) else { for ($page=$start_page; $page <= $end_page; ++$page) { - $this->setPage($page); + $pdf->setPage($page); if ($page == $start_page) { // first page - $height = $this->h - $start_y - $this->bMargin; + $height = $pdf->h - $start_y - $pdf->bMargin; } elseif ($page == $end_page) { // last page - $height = $end_y - $this->tMargin; + $height = $end_y - $pdf->tMargin; } else { - $height = $this->h - $this->tMargin - $this->bMargin; + $height = $pdf->h - $pdf->tMargin - $pdf->bMargin; } } } From c67fa4129854dc997d2b79ffe9ed7e9de5762e4e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 23 Jun 2016 16:29:06 +0200 Subject: [PATCH 004/144] FIX : Translate group perms as it is done into user perms --- htdocs/user/group/perms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 9ffda5e96c8..fa8e31e71a1 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -315,7 +315,7 @@ if ($id) print ' '; } - $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle)); + $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle))); print ''.$perm_libelle. ''; print ''; From 25631b236bf37db10c0279c7e22e153362783eb1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Jun 2016 16:47:21 +0200 Subject: [PATCH 005/144] Fix: missing rename field "shortname" to "ref" --- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 1 + 1 file changed, 1 insertion(+) 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 e939563cf9b..0ddeaf8f3ad 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 @@ -136,6 +136,7 @@ CREATE TABLE llx_website tms timestamp ) ENGINE=innodb; ALTER TABLE llx_website ADD COLUMN fk_default_home integer; +ALTER TABLE llx_website CHANGE COLUMN shortname ref varchar(24) NOT NULL; ALTER TABLE llx_website ADD UNIQUE INDEX uk_website_ref (ref, entity); CREATE TABLE llx_website_page From 0c5eaddf7a4fee7525a95cbd8320fac120c55f8f Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 23 Jun 2016 19:56:17 +0200 Subject: [PATCH 006/144] internationalization of code comment --- htdocs/categories/class/categorie.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8e98e0014e8..7c7c35d4b05 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2016 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke @@ -149,7 +149,7 @@ class Categorie extends CommonObject */ var $type; - var $cats=array(); // Tableau en memoire des categories + var $cats=array(); // Categories table in memory var $motherof=array(); /** @@ -232,9 +232,9 @@ class Categorie extends CommonObject * Add category into database * * @param User $user Object user - * @return int -1 : erreur SQL - * -2 : nouvel ID inconnu - * -3 : categorie invalide + * @return int -1 : SQL error + * -2 : new ID unknown + * -3 : Invalid category * -4 : category already exists */ function create($user) @@ -304,7 +304,7 @@ class Categorie extends CommonObject $action='create'; // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! + // TODO the hook duplicates the trigger !! $hookmanager->initHooks(array('HookModuleNamedao')); $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -398,7 +398,7 @@ class Categorie extends CommonObject $action='update'; // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! + // TODO the hook duplicates the trigger !! $hookmanager->initHooks(array('HookCategorydao')); $parameters=array(); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks @@ -867,8 +867,8 @@ class Categorie extends CommonObject } /** - * Reconstruit l'arborescence des categories sous la forme d'un tableau - * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: + * Rebuilding the category tree as an array + * Return an array of table('id','id_mere',...) trie selon arbre et avec: * id = id de la categorie * id_mere = id de la categorie mere * id_children = tableau des id enfant From 2223ec15d187c0c553598143a5ff49b7902ef986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jun 2016 20:19:35 +0200 Subject: [PATCH 007/144] Fix doxygen errors --- htdocs/core/class/html.form.class.php | 8 ++++---- htdocs/core/lib/functions2.lib.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 19c779dc2d2..b3643fa4f53 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2737,12 +2737,12 @@ class Form /** - * Retourne la liste des types de paiements possibles + * Return list of payment modes * * @param string $selected Id du type de paiement pre-selectionne * @param string $htmlname Nom de la zone select - * @param string $filtertype Pour filtre - * @param int $addempty Ajoute entree vide + * @param int $filtertype Not used + * @param int $addempty Add an empty entry * @return void */ function select_conditions_paiements($selected='',$htmlname='condid',$filtertype=-1,$addempty=0) @@ -5109,7 +5109,7 @@ class Form * @param int $id Id of object * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended) - * @return mixed Array of category objects or < 0 if KO + * @return string String with categories */ function showCategories($id, $type, $rendermode=0) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 15c1fb498ee..b7c97c7032e 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -484,7 +484,7 @@ function dol_print_object_info($object, $usetable=0) * * @param string $email Email address (Ex: "toto@example.com", "John Do ") * @param string $trackingid Tracking id (Ex: thi123 for thirdparty with id 123) - * @return boolean True if domain email is OK, False if KO + * @return string Return email tracker string */ function dolAddEmailTrackId($email, $trackingid) { From 23620e31334bc5dd295ea294023728818df49370 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 23 Jun 2016 18:19:43 +0000 Subject: [PATCH 008/144] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/core/boxes/modules_boxes.php | 2 +- htdocs/core/class/html.formadmin.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/lib/functions2.lib.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 7bc8672ddab..238aa8ab438 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -197,7 +197,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines * @param int $nooutput No print, only return string - * @return void + * @return string */ function showBox($head = null, $contents = null, $nooutput=0) { diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 17b7eeb192f..33393f1ef46 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -124,7 +124,7 @@ class FormAdmin * @param string $htmlname Name of html select * @param array $dirmenuarray Array of directories to scan * @param string $moreattrib More attributes on html select tag - * @return void + * @return integer|null */ function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 0f6edbcfd15..05bbbd941d9 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -204,7 +204,7 @@ class FormCompany * Ainsi les liens avec les departements se font sur un departement independemment de son nom. * * @param string $selected Code state preselected (mus be state id) - * @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show + * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $htmlname Id of department * @return string String with HTML select * @see select_country diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 15c1fb498ee..2183b530ed0 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1239,7 +1239,7 @@ function hexbin($hexa) * Retourne le numero de la semaine par rapport a une date * * @param string $time Date au format 'timestamp' - * @return int Number of week + * @return string Number of week */ function numero_semaine($time) { From 9b50150fe8d2248fec8414c0ab2fba70802b6719 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jun 2016 20:47:27 +0200 Subject: [PATCH 009/144] FIX #5380 --- htdocs/compta/facture/class/facture.class.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6633f196eed..591dd509701 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2208,27 +2208,32 @@ class Facture extends CommonInvoice $this->line->fk_facture=$this->id; $this->line->label=$label; // deprecated $this->line->desc=$desc; - $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise + $this->line->tva_tx=$txtva; $this->line->localtax1_tx=$txlocaltax1; $this->line->localtax2_tx=$txlocaltax2; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative + $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); // For credit note and if qty is negative, total is negative + $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative + $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative + $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative + $this->line->fk_product=$fk_product; $this->line->product_type=$product_type; $this->line->remise_percent=$remise_percent; - $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise $this->line->date_start=$date_start; $this->line->date_end=$date_end; $this->line->ventil=$ventil; $this->line->rang=$rangtouse; $this->line->info_bits=$info_bits; $this->line->fk_remise_except=$fk_remise_except; - $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva= $total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; - $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; $this->line->origin=$origin; From d72d22cda45f6f504fff7e0a7e5ae7f09a4ace7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jun 2016 23:22:30 +0200 Subject: [PATCH 010/144] Fix confusing translation --- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/langs/en_US/mails.lang | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a0afc8bcc94..dbd993cba25 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -961,7 +961,7 @@ class FormMail extends Form // For mass emailing, we have different keys $vars=array( '__ID__' => 'IdRecord', - '__EMAIL__' => 'EMail', + '__EMAIL__' => 'EMailRecipient', '__LASTNAME__' => 'Lastname', '__FIRSTNAME__' => 'Firstname', '__MAILTOEMAIL__' => 'TagMailtoEmail', diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 79c7aff2029..b57b1e4bdae 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -102,7 +102,8 @@ YouCanUseCommaSeparatorForSeveralRecipients=You can use the comma separat TagCheckMail=Track mail opening TagUnsubscribe=Unsubscribe link TagSignature=Signature sending user -TagMailtoEmail=Recipient EMail +EMailRecipient=Recipient EMail +TagMailtoEmail=Recipient EMail (including html "mailto:" link) NoEmailSentBadSenderOrRecipientEmail=No email sent. Bad sender or recipient email. Verify user profile. # Module Notifications Notifications=Notifications From 227bdb9838bde8d03ae13ed99494824ad7bcc9d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 00:45:35 +0200 Subject: [PATCH 011/144] FIX extrafields was not visible on tab "subscription" FIX Link between membership and invoice was not saved --- htdocs/adherents/card_subscriptions.php | 11 ++ htdocs/adherents/fiche_subscription.php | 160 ++++++++++++------ htdocs/adherents/tpl/index.html | 0 .../adherents/tpl/linkedobjectblock.tpl.php | 55 ++++++ htdocs/core/class/commonobject.class.php | 11 +- htdocs/core/class/html.form.class.php | 9 +- 6 files changed, 184 insertions(+), 62 deletions(-) create mode 100644 htdocs/adherents/tpl/index.html create mode 100644 htdocs/adherents/tpl/linkedobjectblock.tpl.php diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 784f6d4dea7..dcc8b671259 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -53,6 +53,10 @@ $result=restrictedArea($user,'adherent',$rowid,'','cotisation'); $object = new Adherent($db); $extrafields = new ExtraFields($db); $adht = new AdherentType($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $errmsg=''; $errmsgs=array(); @@ -379,6 +383,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $invoice->socid=$object->fk_soc; $invoice->date=$datecotisation; + // Possibility to add external linked objects with hooks + $invoice->linked_objects['subscription'] = $crowid; + if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects'])) + { + $invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']); + } + $result=$invoice->create($user); if ($result <= 0) { diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 6b980a4df1c..28fb2268d4c 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -33,35 +33,49 @@ $langs->load("members"); $langs->load("users"); $adh = new Adherent($db); -$subscription = new Cotisation($db); +$object = new Cotisation($db); $errmsg=''; -$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; -$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; -$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; +$action=GETPOST("action",'alpha'); +$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int"); +$typeid=GETPOST("typeid","int"); +$cancel=GETPOST('cancel'); if (! $user->rights->adherent->cotisation->lire) accessforbidden(); +$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink=$user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php +$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php + /* * Actions */ +if ($cancel) $action=''; + +//include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + +//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + + if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update' && ! $_POST["cancel"]) { // Charge objet actuel - $result=$subscription->fetch($_POST["rowid"]); + $result=$object->fetch($_POST["rowid"]); if ($result > 0) { $db->begin(); $errmsg=''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $accountline=new AccountLine($db); - $result=$accountline->fetch($subscription->fk_bank); + $result=$accountline->fetch($object->fk_bank); // If transaction consolidated if ($accountline->rappro) @@ -84,31 +98,31 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update if (! $errmsg) { // Modifie valeures - $subscription->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); - $subscription->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); - $subscription->note=$_POST["note"]; - $subscription->amount=$_POST["amount"]; - //print 'datef='.$subscription->datef.' '.$_POST['datesubendday']; + $object->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); + $object->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); + $object->note=$_POST["note"]; + $object->amount=$_POST["amount"]; + //print 'datef='.$object->datef.' '.$_POST['datesubendday']; - $result=$subscription->update($user); - if ($result >= 0 && ! count($subscription->errors)) + $result=$object->update($user); + if ($result >= 0 && ! count($object->errors)) { $db->commit(); - header("Location: fiche_subscription.php?rowid=".$subscription->id); + header("Location: fiche_subscription.php?rowid=".$object->id); exit; } else { $db->rollback(); - if ($subscription->error) + if ($object->error) { - $errmsg=$subscription->error; + $errmsg=$object->error; } else { - foreach($subscription->errors as $error) + foreach($object->errors as $error) { if ($errmsg) $errmsg.='
'; $errmsg.=$error; @@ -126,11 +140,11 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->adherent->cotisation->creer) { - $result=$subscription->fetch($rowid); - $result=$subscription->delete($user); + $result=$object->fetch($rowid); + $result=$object->delete($user); if ($result > 0) { - header("Location: card_subscriptions.php?rowid=".$subscription->fk_adherent); + header("Location: card_subscriptions.php?rowid=".$object->fk_adherent); exit; } else @@ -145,11 +159,12 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && * View */ -llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - $form = new Form($db); +llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); + + dol_htmloutput_errors($errmsg); @@ -161,8 +176,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') * ********************************************/ - $subscription->fetch($rowid); - $result=$adh->fetch($subscription->fk_adherent); + $object->fetch($rowid); + $result=$adh->fetch($object->fk_adherent); /* * Affichage onglets @@ -170,12 +185,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("SubscriptionCard"); $head[$h][2] = 'general'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; @@ -184,7 +199,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') print ''; print ""; print ""; - print "fk_bank."\">"; + print "fk_bank."\">"; dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); @@ -196,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Ref print ''.$langs->trans("Ref").''; print ''; - print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print $form->showrefnav($object, 'rowid', $linkback, 1); print ''; // Member @@ -207,34 +222,34 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Date start subscription print ''.$langs->trans("DateSubscription").''; - $form->select_date($subscription->dateh,'datesub',1,1,0,'update',1); + $form->select_date($object->dateh,'datesub',1,1,0,'update',1); print ''; print ''; // Date end subscription print ''.$langs->trans("DateEndSubscription").''; - $form->select_date($subscription->datef,'datesubend',0,0,0,'update',1); + $form->select_date($object->datef,'datesubend',0,0,0,'update',1); print ''; print ''; // Amount print ''.$langs->trans("Amount").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; - print ''; + print ''; // Bank line if (! empty($conf->banque->enabled)) { - if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) + if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { print ''.$langs->trans("BankTransactionLine").''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $bankline=new AccountLine($db); - $result=$bankline->fetch($subscription->fk_bank); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else @@ -267,8 +282,8 @@ if ($rowid && $action != 'edit') /* */ /* ************************************************************************** */ - $result=$subscription->fetch($rowid); - $result=$adh->fetch($subscription->fk_adherent); + $result=$object->fetch($rowid); + $result=$adh->fetch($object->fk_adherent); /* * Affichage onglets @@ -276,12 +291,12 @@ if ($rowid && $action != 'edit') $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("SubscriptionCard"); $head[$h][2] = 'general'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id; + $head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; @@ -295,7 +310,7 @@ if ($rowid && $action != 'edit') //$formquestion['text']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); - print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); } print '
'; @@ -307,7 +322,7 @@ if ($rowid && $action != 'edit') // Ref print ''.$langs->trans("Ref").''; print ''; - print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print $form->showrefnav($object, 'rowid', $linkback, 1); print ''; // Member @@ -318,35 +333,35 @@ if ($rowid && $action != 'edit') // Date record /*print ''; - print ''.$langs->trans("DateSubscription").''.dol_print_date($subscription->datec,'dayhour').''; + print ''.$langs->trans("DateSubscription").''.dol_print_date($object->datec,'dayhour').''; print '';*/ // Date subscription print ''; - print ''.$langs->trans("DateSubscription").''.dol_print_date($subscription->dateh,'day').''; + print ''.$langs->trans("DateSubscription").''.dol_print_date($object->dateh,'day').''; print ''; // Date end subscription print ''; - print ''.$langs->trans("DateEndSubscription").''.dol_print_date($subscription->datef,'day').''; + print ''.$langs->trans("DateEndSubscription").''.dol_print_date($object->datef,'day').''; print ''; // Amount - print ''.$langs->trans("Amount").''.price($subscription->amount).''; + print ''.$langs->trans("Amount").''.price($object->amount).''; // Amount - print ''.$langs->trans("Label").''.$subscription->note.''; + print ''.$langs->trans("Label").''.$object->note.''; // Bank line if (! empty($conf->banque->enabled)) { - if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) + if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { print ''.$langs->trans("BankTransactionLine").''; - if ($subscription->fk_bank) + if ($object->fk_bank) { $bankline=new AccountLine($db); - $result=$bankline->fetch($subscription->fk_bank); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else @@ -373,7 +388,7 @@ if ($rowid && $action != 'edit') { if (! $bankline->rappro) { - print '"; + print '"; } else { @@ -384,12 +399,49 @@ if ($rowid && $action != 'edit') // Supprimer if ($user->rights->adherent->cotisation->creer) { - print '\n"; + print '\n"; } print ''; - print "
\n"; - + + + print '
'; + print ''; // ancre + + // Documents generes + /* + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id; + $genallowed = $user->rights->facture->creer; + $delallowed = $user->rights->facture->supprimer; + + print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + $somethingshown = $formfile->numoffiles; + */ + // Linked object block + $somethingshown = $form->showLinkedObjectBlock($object); + + // Show links to link elements + /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); + if ($linktoelem) print '
'.$linktoelem; + + // Link for paypal payment + if (! empty($conf->paypal->enabled) && $object->statut != 0) { + include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; + print showPaypalPaymentUrl('invoice', $object->ref); + } + */ + print '
'; + + // List of actions on element + /* + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'invoice', $socid); + */ + + print '
'; } diff --git a/htdocs/adherents/tpl/index.html b/htdocs/adherents/tpl/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..f593e72faa9 --- /dev/null +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,55 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +?> + + + +load("members"); + +$var=true; +$total=0; +foreach($linkedObjectBlock as $key => $objectlink) +{ + $var=!$var; +?> + > + trans("Subscription"); ?> + getNomUrl(1); ?> + + dateh,'day'); ?> + rights->adherent->lire) { + $total = $total + $objectlink->amount; + echo price($objectlink->amount); + } ?> + + ">transnoentitiesnoconv("RemoveLink")); ?> + + + + \ No newline at end of file diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 15272a19d6c..83499a85b3a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2541,12 +2541,10 @@ abstract class CommonObject else if ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter'; } - - // TODO ajout temporaire - MAXIME MANGIN - else if ($objecttype == 'contratabonnement') { - $classpath = 'contrat/class'; $subelement = 'contrat'; $module = 'contratabonnement'; + else if ($objecttype == 'subscription') { + $classpath = 'adherents/class'; $module = 'adherent'; } - + // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); @@ -2562,6 +2560,9 @@ abstract class CommonObject else if ($objecttype == 'facturerec') { $classfile = 'facture-rec'; $classname = 'FactureRec'; } + else if ($objecttype == 'subscription') { + $classfile = 'cotisation'; $classname = 'Cotisation'; + } // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b3643fa4f53..d4267eccfb1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5170,7 +5170,7 @@ class Form { $num = count($object->linkedObjects); $numoutput=0; - + foreach($object->linkedObjects as $objecttype => $objects) { $tplpath = $element = $subelement = $objecttype; @@ -5217,7 +5217,10 @@ class Form else if ($objecttype == 'expensereport') { $tplpath = 'expensereport'; } - + else if ($objecttype == 'subscription') { + $tplpath = 'adherents'; + } + global $linkedObjectBlock; $linkedObjectBlock = $objects; @@ -5225,7 +5228,7 @@ class Form { $numoutput++; - echo '
'; + print '
'; print load_fiche_titre($langs->trans('RelatedObjects'), '', ''); print ''; From eddab57f3292987c6605eee2111b54dc5d2edd19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 01:00:37 +0200 Subject: [PATCH 012/144] Minor css fix --- htdocs/theme/eldy/style.css.php | 5 ++++- htdocs/theme/md/style.css.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9bdbd3bb4b7..056d1bff97a 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2731,7 +2731,10 @@ form.liste_total div { border-top-color: rgb() !important; border-top-style: solid !important; } - +.paymenttable tr td:first-child, .margintable tr td:first-child +{ + padding-left: 2px; +} .margintable td { border: 0px !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ed60bf1e876..f4e7fe8342a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2599,7 +2599,10 @@ input.liste_titre { border-top-color: rgb() !important; border-top-style: solid !important; } - +.paymenttable tr td:first-child, .margintable tr td:first-child +{ + padding-left: 2px; +} .margintable td { border: 0px !important; } From 453c6264bf6bf7f0ba3bcdabd05541fa54efaedb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 02:19:41 +0200 Subject: [PATCH 013/144] FIX: Hidden option EXPORTTOOL_CATEGORIES was not working correctly --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/modules/modProduct.class.php | 10 +++++++--- htdocs/exports/class/export.class.php | 15 ++++++++++++++- htdocs/exports/export.php | 15 +++++++++------ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8a259ce2e57..1363e5012aa 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -577,7 +577,7 @@ class FormFile $file_list=dol_dir_list($filedir,'files',0,'','(\.meta|_preview\.png)$','date',SORT_DESC); // Show title of array if not already shown - if ((! empty($file_list) || preg_match('/^massfilesarea', $modulepart)) && ! $headershown) + if ((! empty($file_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown) { $headershown=1; $out.= '
'.$titletoshow.'
'; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index a36abbf0b0f..b88e4ed9f83 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -153,27 +153,31 @@ class modProduct extends DolibarrModules if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.pmp'=>'Numeric')); + if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('group_concat(cat.label)'=>'Categories')); $keyforselect='product'; $keyforelement='product'; $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.'product as p'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object'; if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; - + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Exports product multiprice diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 6632f050550..3bf2f87c3b1 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -234,19 +234,32 @@ class Export } $sql.=$this->array_export_sql_end[$indice]; - // Add the filtering into sql if a filtering array is provided + // Add the WHERE part. Filtering into sql if a filtering array is provided if (is_array($array_filterValue) && !empty($array_filterValue)) { $sqlWhere=''; // Loop on each condition to add foreach ($array_filterValue as $key => $value) { + if (preg_match('/group_concat/', $key)) continue; if ($value != '') $sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); } $sql.=$sqlWhere; } + + // Add the order $sql.=$this->array_export_sql_order[$indice]; + // Add the HAVING part. + if (is_array($array_filterValue) && !empty($array_filterValue)) + { + // Loop on each condition to add + foreach ($array_filterValue as $key => $value) + { + if (preg_match('/group_concat/', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); + } + } + return $sql; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 50ca1e09a91..11ae0fc9218 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -561,6 +561,8 @@ if ($step == 2 && $datatoexport) print '
'; // Visibility From 2767df2e0181326201cac647441a76b6b118a406 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 16:10:52 +0200 Subject: [PATCH 021/144] FIX Solve problem of sending joinded files of another email when several tabs are opened on form to send emails. --- dev/skeletons/modMyModule.class.php | 4 +- htdocs/comm/mailing/card.php | 6 +- htdocs/core/actions_sendmails.inc.php | 59 ++++--- htdocs/core/class/html.formmail.class.php | 54 +++--- htdocs/core/lib/files.lib.php | 28 +-- htdocs/core/modules/modCron.class.php | 2 +- htdocs/expedition/card.php | 8 +- htdocs/fichinter/card.php | 175 ++----------------- htdocs/fourn/commande/card.php | 201 ++-------------------- htdocs/fourn/facture/card.php | 189 ++------------------ htdocs/supplier_proposal/card.php | 2 +- 11 files changed, 129 insertions(+), 599 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 7fa7aae9756..e2fd0df923d 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -180,8 +180,8 @@ class modMyModule extends DolibarrModules // Cronjobs $this->cronjobs = array(); // List of cron jobs entries to add - // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true) // ); // Permissions diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1a54340e7ce..443b6144e5a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -259,7 +259,8 @@ if (empty($reshook)) } // Fabrication du mail - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css); + $trackid=''; // TODO Define a trackid for mass emailing too. We can use source type for this. + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid); if ($mail->error) { @@ -1115,7 +1116,8 @@ else // Subject print ''; - dol_init_file_process($upload_dir); + $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we shoul set a trackid here, even if we use another one into email header. + dol_init_file_process($upload_dir, $trackid); // Joined files $addfileaction='addfile'; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 58c48d5b254..a5e6a29b50a 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -22,8 +22,6 @@ */ -// TODO Include this include file into all element pages allowing email sending - // $id must be defined // $actiontypecode must be defined // $paramname must be defined @@ -34,13 +32,15 @@ */ if (GETPOST('addfile')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $trackid = GETPOST('trackid','aZ09'); + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - dol_add_file_process($upload_dir_tmp,0,0); + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid); $action='presend'; } @@ -49,33 +49,39 @@ if (GETPOST('addfile')) */ if (! empty($_POST['removedfile']) && empty($_POST['removAll'])) { + $trackid = GETPOST('trackid','aZ09'); + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); + // TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir" + // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array. + dol_remove_file_process(GETPOST('removedfile','alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically $action='presend'; } /* * Remove all files in email form */ - -if(! empty($_POST['removAll'])) +if (GETPOST('removAll')) { - $listofpaths=array(); + $trackid = GETPOST('trackid','aZ09'); + + $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - + $formmail->trackid = $trackid; + foreach($listofpaths as $key => $value) { $pathtodelete = $value; @@ -94,7 +100,9 @@ if(! empty($_POST['removAll'])) */ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected']) { - if($conf->dolimail->enabled) $langs->load("dolimail@dolimail"); + $trackid = GETPOST('trackid','aZ09'); + + if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail"); $langs->load('mails'); $subject='';$actionmsg='';$actionmsg2=''; @@ -195,7 +203,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); if ($mode == 'emailfrominvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); - + if ($mode == 'emailfromsupplierproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); + if ($mode == 'emailfromsupplierorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); + if ($mode == 'emailfromsupplierinvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send' || $action == 'relance') @@ -215,13 +226,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Create form object include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - + $formmail->trackid = $trackid; // $trackid must be defined + $attachedfiles=$formmail->get_attached_files(); $filepath = $attachedfiles['paths']; $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; - $trackid = GETPOST('trackid','aZ09'); // Feature to push mail sent into Sent folder if (! empty($conf->dolimail->enabled)) @@ -270,7 +281,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); if ($mailfile->error) { - $mesgs[]='
'.$mailfile->error.'
'; + setEventMessage($mailfile->error, 'errors'); + $action='presend'; } else { @@ -351,13 +363,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $action = 'presend'; } } - /* } - else - { - $langs->load("other"); - $mesgs[]='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; - dol_syslog('Recipient email is empty'); - }*/ } else { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 8aff48d4cb8..4d2062f03c7 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -121,7 +121,7 @@ class FormMail extends Form } /** - * Clear list of attached files in send mail form (stored in session) + * Clear list of attached files in send mail form (also stored in session) * * @return void */ @@ -132,12 +132,13 @@ class FormMail extends Form // Set tmp user directory $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir = $vardir.'/temp/'; + $upload_dir = $vardir.'/temp/'; // TODO Add $keytoavoidconflict in upload_dir path if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir); - unset($_SESSION["listofpaths"]); - unset($_SESSION["listofnames"]); - unset($_SESSION["listofmimes"]); + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + unset($_SESSION["listofpaths".$keytoavoidconflict]); + unset($_SESSION["listofnames".$keytoavoidconflict]); + unset($_SESSION["listofmimes".$keytoavoidconflict]); } /** @@ -153,17 +154,19 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if (! in_array($file,$listofnames)) { $listofpaths[]=$path; $listofnames[]=$file; $listofmimes[]=$type; - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); + $_SESSION["listofpaths".$keytoavoidconflict]=join(';',$listofpaths); + $_SESSION["listofnames".$keytoavoidconflict]=join(';',$listofnames); + $_SESSION["listofmimes".$keytoavoidconflict]=join(';',$listofmimes); } } @@ -178,17 +181,19 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { unset ($listofpaths[$keytodelete]); unset ($listofnames[$keytodelete]); unset ($listofmimes[$keytodelete]); - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); + $_SESSION["listofpaths".$keytoavoidconflict]=join(';',$listofpaths); + $_SESSION["listofnames".$keytoavoidconflict]=join(';',$listofnames); + $_SESSION["listofmimes".$keytoavoidconflict]=join(';',$listofmimes); //var_dump($_SESSION['listofpaths']); } } @@ -203,9 +208,11 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes); } @@ -260,9 +267,10 @@ class FormMail extends Form $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); // Define output language $outputlangs = $langs; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5db75628b1e..7ce5b18456b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1392,12 +1392,14 @@ function dol_meta_create($object) /** - * Init $_SESSION with uploaded files + * Scan a directory and init $_SESSION to manage uploaded files with list of all found files. + * Note: Only email module seems to use this. Other feature initialize the $_SESSION doing $formmail->clear_attached_files(); $formmail->add_attached_files() * * @param string $pathtoscan Path to scan + * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @return void */ -function dol_init_file_process($pathtoscan='') +function dol_init_file_process($pathtoscan='', $trackid='') { $listofpaths=array(); $listofnames=array(); @@ -1413,9 +1415,10 @@ function dol_init_file_process($pathtoscan='') $listofmimes[]=dol_mimetype($val['name']); } } - $_SESSION["listofpaths"]=join(';',$listofpaths); - $_SESSION["listofnames"]=join(';',$listofnames); - $_SESSION["listofmimes"]=join(';',$listofmimes); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + $_SESSION["listofpaths".$keytoavoidconflict]=join(';',$listofpaths); + $_SESSION["listofnames".$keytoavoidconflict]=join(';',$listofnames); + $_SESSION["listofmimes".$keytoavoidconflict]=join(';',$listofmimes); } @@ -1430,9 +1433,10 @@ function dol_init_file_process($pathtoscan='') * @param string $varfiles _FILES var name * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $link Link to add + * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @return void */ -function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null) +function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='') { global $db,$user,$conf,$langs; @@ -1482,6 +1486,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); + $formmail->trackid = $trackid; $formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]); } if (image_format_supported($destpath) == 1) @@ -1550,9 +1555,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio * @param int $filenb File nb to delete * @param int $donotupdatesession 1=Do not edit _SESSION variable * @param int $donotdeletefile 1=Do not delete physically file + * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) * @return void */ -function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1) +function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1,$trackid='') { global $db,$user,$conf,$langs,$_FILES; @@ -1562,9 +1568,10 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + $keytoavoidconflict = empty($trackid)?'':'-'.$trackid; + if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); + if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); + if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { @@ -1583,6 +1590,7 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); + $formmail->trackid = $trackid; $formmail->remove_attached_files($keytodelete); } } diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 89a90dfc8bd..22e66431e4e 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -101,7 +101,7 @@ class modCron extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true), + 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true), 1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>20, 'status'=>0, 'test'=>in_array($db->type, array('mysql','mysqli'))), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b4b82be7726..57553d17718 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1925,7 +1925,6 @@ else if ($id || $ref) $formmail->setSubstitFromObject($object); $formmail->substit['__SHIPPINGREF__']=$object->ref; - //Find the good contact adress //Find the good contact adress if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { $objectsrc=new Commande($db); @@ -1937,8 +1936,11 @@ else if ($id || $ref) } $custcontact=''; $contactarr=array(); - $contactarr=$objectsrc->liste_contact(-1,'external'); - + if (is_object($objectsrc)) // For the case the shipment was created without orders + { + $contactarr=$objectsrc->liste_contact(-1,'external'); + } + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a54a983f514..567c60408e7 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -700,174 +700,19 @@ if (empty($reshook)) exit; } - - /* - * Add file in email form - */ - if (GETPOST('addfile','alpha')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - /* - * Remove file in email form - */ - if (GETPOST('removedfile','alpha')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - /* * Send mail - */ - if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) - { - $langs->load('mails'); + */ + + // Actions to send emails + $actiontypecode='AC_OTH_AUTO'; + $trigger_name='FICHINTER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromintervention'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (strlen(GETPOST('subject','alphs'))) $subject = GETPOST('subject','alpha'); - else $subject = $langs->transnoentities('Intervention').' '.$object->ref; - $actiontypecode='AC_OTH_AUTO'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send by email - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - $mesg='
'.$mailfile->error.'
'; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessages($mesg, null, 'mesgs'); - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $object->errors=$interface->errors; - } - // Fin appel triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - $mesg='
'; - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - $mesg.='
'; - } - } - } - else - { - $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; - dol_syslog('Recipient email is empty'); - } - - $action='presend'; - } - - else if ($action == 'update_extras') + if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c940486d73b..fa93be5020d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -870,10 +870,10 @@ if (empty($reshook)) if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post { // Build document - - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - + + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); + $outputlangs = $langs; if (GETPOST('lang_id')) { @@ -883,7 +883,7 @@ if (empty($reshook)) $result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -899,7 +899,7 @@ if (empty($reshook)) if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); } - + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form @@ -1145,190 +1145,17 @@ if (empty($reshook)) } } - /* - * Add file in email form - */ - if (GETPOST('addfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - /* - * Remove file in email form - */ - if (GETPOST('removedfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - /* * Send mail */ - if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) - { - $langs->load('mails'); - - if ($object->id > 0) - { - // $ref = dol_sanitizeFileName($object->ref); - // $file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - - // if (is_readable($file)) - // { - if (GETPOST('sendto','alpha')) - { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto','alpha'); - $sendtoid = 0; - } - elseif (GETPOST('receiver','alpha') != '-1') - { - // Recipient was provided from combo list - if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver','alpha'),'email'); - $sendtoid = GETPOST('receiver','alpha'); - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>'; - $replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc','alpha'); - $deliveryreceipt = GETPOST('deliveryreceipt','alpha'); - - if ($action == 'send') - { - if (dol_strlen(GETPOST('subject'))) $subject=GETPOST('subject'); - else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; - $actiontypecode='AC_SUP_ORD'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " - setEventMessages($mesg, null, 'mesgs'); - - $error=0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('ORDER_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers - - if ($error) - { - setEventMessages($object->error, $object->errors, 'errors'); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg = $langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.= '
'.$mailfile->error; - } - else - { - $mesg = 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - - setEventMessages($mesg, null, 'errors'); - } - } - /* } - else - { - $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; - $action='presend'; - dol_syslog('Recipient email is empty'); - }*/ - } - else - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorCantReadFile',$file), null, 'errors'); - dol_syslog('Failed to read file: '.$file); - } - } - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), null, 'errors'); - dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.'); - } - } + + // Actions to send emails + $actiontypecode='AC_SUP_ORD'; + $trigger_name='ORDER_SUPPLIER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromsupplierorder'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel')) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f078c714416..d14a43764d7 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -932,184 +932,17 @@ if (empty($reshook)) } } - // Add file in email form - if (GETPOST('addfile')) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; - } - - // Remove file in email form - if (! empty($_POST['removedfile'])) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile','alpha'),0); - $action='presend'; - } - - // Send mail - if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) - { - $langs->load('mails'); - - $object->fetch($id); - $result=$object->fetch_thirdparty(); - if ($result > 0) - { - if ($_POST['sendto']) - { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; - - if ($action == 'send') - { - if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; - else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref; - $actiontypecode='AC_SUP_INV'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); - if ($mailfile->error) - { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " - setEventMessages($mesg, null, 'mesgs'); - - $error=0; - - // Init data for trigger - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - $object->email_subject = $subject; - $object->email_to = $sendto; - $object->email_tocc = $sendtocc; - $object->email_tobcc = $sendtobcc; - $object->email_from = $from; - $object->email_content = $_POST['message']; - - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $object->errors=$interface->errors; - } - // End call triggers - - if ($error) - { - dol_print_error($db); - } - else - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessages($mesg, null, 'errors'); - } - } - } - - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorMailRecipientIsEmpty'), null, 'errors'); - dol_syslog('Recipient email is empty'); - } - } - else - { - $langs->load("other"); - setEventMessages($langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")), null, 'errors'); - dol_syslog('Unable to read data from the invoice. The invoice file has perhaps not been generated.'); - } - - //$action = 'presend'; - } + /* + * Send mail + */ + + // Actions to send emails + $actiontypecode='AC_SUP_INV'; + $trigger_name='BILL_SUPPLIER_SENTBYMAIL'; + $paramname='id'; + $mode='emailfromsupplierinvoice'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + // Build document if ($action == 'builddoc') diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8e8c69b0ce9..3e7871b2c4a 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -476,7 +476,7 @@ if (empty($reshook)) $actiontypecode='AC_ASKPRICE'; $trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL'; $paramname='id'; - $mode='emailfromsupplier_proposal'; + $mode='emailfromsupplierproposal'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; From f97b67db6b5f715c50ae49a4f9c47a163159fa44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 17:04:59 +0200 Subject: [PATCH 022/144] Fix: error message was not enough to understand --- htdocs/comm/propal/class/propal.class.php | 3 ++- htdocs/commande/class/commande.class.php | 6 ++++-- htdocs/compta/facture/class/facture.class.php | 6 ++++-- htdocs/expedition/class/expedition.class.php | 6 ++++-- htdocs/langs/en_US/errors.lang | 4 ++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1ff75f2b661..43416875d95 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -438,7 +438,8 @@ class Propal extends CommonObject $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3ecbe763d0b..8fcc7d41ef1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1278,7 +1278,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); return self::STOCK_NOT_ENOUGH_FOR_ORDER; @@ -2642,7 +2643,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); unset($_POST['productid']); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a2c63ee41ad..95d24d2ce06 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2314,7 +2314,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2552,7 +2553,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a7375c451a8..643ad6995a9 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -896,7 +896,8 @@ class Expedition extends CommonObject $product_type=$product->type; if ($product_type == 0 && $product_stock < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); $this->db->rollback(); return -3; } @@ -952,7 +953,8 @@ class Expedition extends CommonObject if ($prod_batch->qty < $linebatch->dluo_qty) { - $this->errors[] = $langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); $this->db->rollback(); return -1; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5d4ea34ded4..3c5d0e1cf12 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -170,6 +170,10 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship ErrorFileMustHaveFormat=File must have format %s ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled. +ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order. +ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. +ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. +ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 1368e6d462c7191a79977cb88effb22541ae72e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 17:04:59 +0200 Subject: [PATCH 023/144] Fix: error message was not enough to understand Conflicts: htdocs/langs/en_US/errors.lang --- htdocs/comm/propal/class/propal.class.php | 3 ++- htdocs/commande/class/commande.class.php | 6 ++++-- htdocs/compta/facture/class/facture.class.php | 6 ++++-- htdocs/expedition/class/expedition.class.php | 6 ++++-- htdocs/langs/en_US/errors.lang | 7 +++++++ 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 112dbf792ff..463c81266f8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -429,7 +429,8 @@ class Propal extends CommonObject $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 30d22e7588e..9eb67cecc56 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1242,7 +1242,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); return self::STOCK_NOT_ENOUGH_FOR_ORDER; @@ -2563,7 +2564,8 @@ class Commande extends CommonOrder if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); unset($_POST['productid']); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0bb1a4cf189..27432d7c399 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2138,7 +2138,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2348,7 +2349,8 @@ class Facture extends CommonInvoice $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 143e86330ee..1b7fbefb8a6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -874,7 +874,8 @@ class Expedition extends CommonObject $product_type=$product->type; if ($product_type == 0 && $product_stock < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); $this->db->rollback(); return -3; } @@ -930,7 +931,8 @@ class Expedition extends CommonObject if ($prod_batch->qty < $linebatch->dluo_qty) { - $this->errors[] = $langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); $this->db->rollback(); return -1; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 50fd77a85e7..dc3502e027a 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -173,6 +173,13 @@ ErrorOppStatusRequiredIfAmount=You set an estimated amount for this opportunity/ ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu) ErrorSavingChanges=An error has ocurred when saving the changes ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship +ErrorFileMustHaveFormat=File must have format %s +ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. +ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled. +ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order. +ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. +ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. +ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 9ebf7a1e35d2c725d4b3b955ae761278aa5709f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 02:21:54 +0200 Subject: [PATCH 024/144] Try to fix the group_concat function for pgsql. --- dev/skeletons/modMyModule.class.php | 2 +- dev/translation/sanity_check_en_langfiles.php | 1 + htdocs/core/db/pgsql.class.php | 6 +++++- htdocs/core/modules/modProduct.class.php | 3 ++- htdocs/langs/en_US/main.lang | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index e2fd0df923d..09c416a7fd2 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -241,7 +241,7 @@ class modMyModule extends DolibarrModules // $this->export_code[$r]=$this->rights_class.'_'.$r; // $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found) // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. - // $this->export_icon[$r]='generic:MyModule'; + // $this->export_icon[$r]='generic:MyModule'; // Put here code of icon then string for translation key of module name // $this->export_permission[$r]=array(array("mymodule","level1","level2")); // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_TypeFields_array[$r]=array('t.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index eb5ca99ea48..cd652374489 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -299,6 +299,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0; if (preg_match('/^.b$/', $value)) $qualifiedforclean=0; if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0; + if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) $qualifiedforclean=0; if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0; // orders if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index c8b72ebcdd9..ca35fca5b32 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -44,7 +44,7 @@ class DoliDBPgsql extends DoliDB //! Collate used to force collate when creating database var $forcecollate=''; // Can't be static as it may be forced with a dynamic value //! Version min database - const VERSIONMIN='8.4.0'; // Version min database + const VERSIONMIN='9.0.0'; // Version min database /** @var resource Resultset of last query */ private $_results; @@ -315,6 +315,10 @@ class DoliDBPgsql extends DoliDB } } + // Replace group_concat(x) with string_agg(x, ',') + $line=preg_replace('/group_concat\(([^\)]+)\)/','string_agg(\\1, \',\')',$line); + //print $line."\n"; + // Remove () in the tables in FROM if 1 table $line=preg_replace('/FROM\s*\((([a-z_]+)\s+as\s+([a-z_]+)\s*)\)/i','FROM \\1',$line); //print $line."\n"; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index b88e4ed9f83..154639f848d 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -169,6 +169,7 @@ class modProduct extends DolibarrModules if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid'); $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; @@ -176,7 +177,7 @@ class modProduct extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object'; if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields" if (! empty($conf->global->PRODUIT_MULTIPRICES)) { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb59e1dd8fd..329277b9796 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -177,6 +177,7 @@ Groups=Groups NoUserGroupDefined=No user group defined Password=Password PasswordRetype=Retype your password +NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration. Name=Name Person=Person Parameter=Parameter From 48560104006a914f4bb491d6dc7a8012523d63b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 02:30:12 +0200 Subject: [PATCH 025/144] Try to fix the group_concat function for pgsql. --- htdocs/core/db/pgsql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index ca35fca5b32..4e14c6987c0 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -316,7 +316,7 @@ class DoliDBPgsql extends DoliDB } // Replace group_concat(x) with string_agg(x, ',') - $line=preg_replace('/group_concat\(([^\)]+)\)/','string_agg(\\1, \',\')',$line); + $line=preg_replace('/GROUP_CONCAT\(([^\)]+)\)/i','STRING_AGG(\\1, \',\')',$line); //print $line."\n"; // Remove () in the tables in FROM if 1 table From 1c1d8887b14811a34db62a2e5869703a2165c07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 02:45:11 +0200 Subject: [PATCH 026/144] Complete phpunit --- test/phpunit/PgsqlTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 04693c017ed..f25ea3ea72f 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -162,6 +162,12 @@ class PgsqlTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;'); + // Create a constraint + $sql='SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b'; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b"); + return $result; } } From 7004dfbc15898792e011aecf7c85a94633ade695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 25 Jun 2016 09:57:46 +0200 Subject: [PATCH 027/144] typo --- htdocs/fourn/class/fournisseur.product.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index e9a67a0e98e..34a11663e2a 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -6,8 +6,6 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Charlie Benke - - status * * 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 From 5222b78e952a1342659efb4e0b5914ac5d11c85c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 14:20:23 +0200 Subject: [PATCH 028/144] FIX property of bank account were lost if an error occured during saving. --- htdocs/admin/company.php | 6 ++-- htdocs/compta/bank/card.php | 26 +++++++-------- htdocs/compta/bank/index.php | 42 ++++++++++++++----------- htdocs/core/menus/standard/eldy.lib.php | 1 + 4 files changed, 41 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 54150556791..46e83975498 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -308,10 +308,12 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; // If value of entityicon=entitylang='icon:Label' + //print $code.'-'.$label.'-'.$entity; + $tmparray=explode(':',$entityicon); if (count($tmparray) >=2) { @@ -1187,15 +1189,16 @@ exit; // don't know why but apache hangs with php 5.3.10-1ubuntu3.12 and apache */ function getablenamefromfield($code,$sqlmaxforexport) { + $alias=preg_replace('/\.(.*)$/i','',$code); // Keep only 'Alias' and remove '.Fieldname' + $regexstring='/([a-zA-Z_]+) as '.preg_quote($alias).'[, \)]/i'; + $newsql=$sqlmaxforexport; - $newsql=preg_replace('/^(.*) FROM /i','',$newsql); - $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // We must keep the ' ' before WHERE - $alias=preg_replace('/\.(.*)$/i','',$code); - //print $newsql.' '.$alias; - $regexstring='/([a-zA-Z_]+) as '.$alias.'[, \)]/i'; + $newsql=preg_replace('/^(.*) FROM /i','',$newsql); // Remove part before the FROM + $newsql=preg_replace('/WHERE (.*)$/i','',$newsql); // Remove part after the WHERE so we have now only list of table aliases in a string. We must keep the ' ' before WHERE + if (preg_match($regexstring,$newsql,$reg)) { - return $reg[1]; + return $reg[1]; // The tablename } else return ''; } From 3b38e5a870aac3711b9343fdd5453e1d650fb641 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 03:00:34 +0200 Subject: [PATCH 014/144] FIX Withdraw request should not be possible if amount is negative. --- htdocs/compta/facture/prelevement.php | 37 ++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 00254b7440f..0fa260bbe34 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * @@ -483,20 +483,27 @@ if ($object->id > 0) // Add a withdraw request if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0) { - if ($user->rights->prelevement->bons->creer) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - else - { - print ''.$langs->trans("MakeWithdrawRequest").''; - } + if ($resteapayer > 0) + { + if ($user->rights->prelevement->bons->creer) + { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } + } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } } else { From e8eee059626aeba6dec7395a9487d5111fbe43be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 03:05:51 +0200 Subject: [PATCH 015/144] Cleaner css --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 056d1bff97a..979c2622ae3 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -653,7 +653,7 @@ td.showDragHandle { table-layout: fixed; } #id-right, #id-left { - padding-top: 12px; + padding-top: 16px; padding-bottom: 8px; display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ From e144df759c642d61aa8f716be219e46b842624fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 12:50:50 +0200 Subject: [PATCH 016/144] FIX forced bank account was lost on proposal Fix Invoice was using duplicated bugged code for pdf removal link. --- htdocs/compta/facture.php | 56 +++------------------------- htdocs/core/actions_builddoc.inc.php | 10 ++--- 2 files changed, 11 insertions(+), 55 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 375288ce754..14f3ea7075f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1790,57 +1790,13 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - /* - * Generate document - */ - if ($action == 'builddoc') // En get ou en post - { - $object->fetch($id); - $object->fetch_thirdparty(); + // Actions to build doc + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + - // Save last template used to generate document - if (GETPOST('model')) - $object->setDocModel($user, GETPOST('model', 'alpha')); - if (GETPOST('fk_bank')) { // this field may come from an external module - $object->fk_bank = GETPOST('fk_bank'); - } else { - $object->fk_bank = $object->fk_account; - } - - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; - } - } - - // Remove file in doc form - else if ($action == 'remove_file') { - if ($object->fetch($id)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $object->fetch_thirdparty(); - - $langs->load("other"); - $upload_dir = $conf->facture->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - $action = ''; - } - } elseif ($action == 'update_extras') { + if ($action == 'update_extras') { // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 9502d723013..2e5d7d71252 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -51,15 +51,15 @@ if ($action == 'builddoc' && $permissioncreate) // Save last template used to generate document if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - // Special case for invoices - if (property_exists($object, 'fk_bank')) - { + // Special case to force bank account + //if (property_exists($object, 'fk_bank')) + //{ if (GETPOST('fk_bank')) { // this field may come from an external module $object->fk_bank = GETPOST('fk_bank'); - } else { + } else if (! empty($object->fk_account)) { $object->fk_bank = $object->fk_account; } - } + //} $outputlangs = $langs; $newlang=''; From 0bf0937cc6f431b34db6a3ee51c9f81b1f665eb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 13:08:34 +0200 Subject: [PATCH 017/144] FIX: disabled templates must be not visible. --- htdocs/core/class/html.formmail.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index dbd993cba25..8aff48d4cb8 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -327,7 +327,7 @@ class FormMail extends Form ))) { $out.= '
'."\n"; - $out.= $langs->trans('SelectMailModel').': '; + $out.= $langs->trans('SelectMailModel').': '; // Do not put disabled on option, it is already on select and it makes chrome crazy. if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); $out.= '   '; $out.= ''; @@ -770,9 +770,10 @@ class FormMail extends Form * @param string $user Use template public or limited to this user * @param Translate $outputlangs Output lang object * @param int $id Id template to find + * @param int $active 1=Only active template, 0=Only disabled, -1=All * @return array array('topic'=>,'content'=>,..) */ - private function getEMailTemplate($db, $type_template, $user, $outputlangs,$id=0) + private function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1) { $ret=array(); @@ -781,6 +782,7 @@ class FormMail extends Form $sql.= " WHERE type_template='".$db->escape($type_template)."'"; $sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + if ($active >= 0) $sql.=" AND active = ".$active; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; if (!empty($id)) $sql.= " AND rowid=".$id; $sql.= $db->order("lang,label","ASC"); @@ -870,9 +872,10 @@ class FormMail extends Form * @param string $type_template Get message for key module * @param string $user Use template public or limited to this user * @param Translate $outputlangs Output lang object - * @return int <0 if KO, + * @param int $active 1=Only active template, 0=Only disabled, -1=All + * @return int <0 if KO, nb of records found if OK */ - public function fetchAllEMailTemplate($type_template, $user, $outputlangs) + public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active=1) { $ret=array(); @@ -881,6 +884,7 @@ class FormMail extends Form $sql.= " WHERE type_template='".$this->db->escape($type_template)."'"; $sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + if ($active >= 0) $sql.=" AND active = ".$active; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; $sql.= $this->db->order("position,lang,label","ASC"); //print $sql; From 0a5ded20a34f8d88769f9ae1f88d191e5f17b66a Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Fri, 24 Jun 2016 15:27:47 +0200 Subject: [PATCH 018/144] FIX extrafield cloned on project clone --- htdocs/projet/class/project.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7f8aa6252e8..91a75f80ce1 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1121,6 +1121,7 @@ class Project extends CommonObject // Load source object $clone_project->fetch($fromid); + $clone_project->fetch_optionals(); $clone_project->fetch_thirdparty(); $orign_dt_start=$clone_project->date_start; From 6033b093444a8cc67e296124e14b14ef91fbf6e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 15:36:20 +0200 Subject: [PATCH 019/144] FIX: A constructor must not return a value. FIX: A topic is required to send an email (probability to be spam of 99%) --- htdocs/core/class/CMailFile.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 1db31697bb8..563ec168d29 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -134,6 +134,13 @@ class CMailFile dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG); + if (empty($subject)) + { + dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); + $this->error='ErrorSubjectIsRequired'; + return; + } + // Detect if message is HTML (use fast method) if ($msgishtml == -1) { @@ -436,8 +443,7 @@ class CMailFile { // Send mail method not correctly defined // -------------------------------------- - - return 'Bad value for MAIN_MAIL_SENDMODE constant'; + $this->error = 'Bad value for MAIN_MAIL_SENDMODE constant'; } } From 321ccce438c25c3fe55969a310cd5699053b5233 Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Fri, 24 Jun 2016 15:57:08 +0200 Subject: [PATCH 020/144] Fix PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS on project edit view --- htdocs/projet/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index af4a4c7299f..5dc8d8e03b4 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -635,8 +635,12 @@ else $filteronlist=''; if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 1, 1); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); + if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + { + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + } + else print $text; print '
'.$langs->trans("MailTopic").'
'; print ''."\n"; + // Name $var=!$var; print ''."\n"; + // Addresse $var=!$var; print ''."\n"; @@ -392,7 +394,7 @@ if ($action == 'edit' || $action == 'updateedit') // Note $var=!$var; print ''; + print ''; print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; print '
'; print '
'; - print '
'; @@ -531,7 +533,7 @@ if ($action == 'edit' || $action == 'updateedit') // Object of the company $var=!$var; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index e6043167b22..5ba06842c30 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -89,8 +89,7 @@ if ($_POST["action"] == 'add') $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); } - $account->account_number = $accountancy_code_number; + $account->account_number = GETPOST('account_number'); $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->solde = $_POST["solde"]; @@ -172,8 +171,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); } - $account->account_number = $accountancy_code_number; + $account->account_number = GETPOST('account_number'); $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->currency_code = trim($_POST["account_currency_code"]); @@ -287,7 +285,7 @@ if ($action == 'create') // Ref print ''.$langs->trans("Ref").''; - print 'ref).'" maxlength="12">'; + print 'ref).'" maxlength="12">'; // Label print ''.$langs->trans("LabelBankCashAccount").''; @@ -393,10 +391,10 @@ if ($action == 'create') print ''; print ''.$langs->trans("BalanceMinimalAllowed").''; - print 'min_allowed).'">'; + print 'min_allowed).'">'; print ''.$langs->trans("BalanceMinimalDesired").''; - print 'min_desired).'">'; + print 'min_desired).'">'; print ''; print '
'; @@ -407,7 +405,7 @@ if ($action == 'create') // If bank account print ''.$langs->trans("BankName").''; - print ''; + print ''; print ''; // Show fields of bank account @@ -431,7 +429,7 @@ if ($action == 'create') } print ''.$langs->trans($val).''; - print ''; + print ''; print ''; } $ibankey = FormBank::getIBANLabel($account); @@ -440,23 +438,23 @@ if ($action == 'create') // IBAN print ''.$langs->trans($ibankey).''; - print ''; + print ''; print ''.$langs->trans($bickey).''; - print ''; + print ''; print ''.$langs->trans("BankAccountDomiciliation").''; print ""; print ''.$langs->trans("BankAccountOwner").''; - print ''; + print ''; print ''; print ''.$langs->trans("BankAccountOwnerAddress").''; print ""; print ''; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 34cec22fb54..a5038fc2e78 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -45,16 +45,9 @@ $statut=GETPOST('statut'); * View */ -$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; -llxHeader('',$langs->trans('AccountsArea'),$help_url); +$title=$langs->trans('BankAccounts'); -$link=''; -if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; -if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; -print load_fiche_titre($langs->trans("AccountsArea"),$link, 'title_bank.png'); - - -// On charge tableau des comptes financiers (ouverts par defaut) +// Load array of financial accounts (opened by default) $accounts = array(); $sql = "SELECT rowid, courant, rappro"; @@ -66,17 +59,30 @@ $sql.= $db->order('label', 'ASC'); $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $accounts[$objp->rowid] = $objp->courant; - $i++; - } - $db->free($resql); + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $accounts[$objp->rowid] = $objp->courant; + $i++; + } + $db->free($resql); } +$nbtotalofrecords = $num; + + +$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; +llxHeader('',$title,$help_url); + +$link=''; +if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; +if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; + +print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$link,$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); + + /* * Comptes courants (courant = 1) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3e02aa67131..e812d9919fd 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1058,6 +1058,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); + $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); From 945fcc75868ec1ba750c3f0497e7edb13eb64710 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 14:38:10 +0200 Subject: [PATCH 029/144] FIX Better support of GROUP_CONCAT for postgresql --- htdocs/core/db/pgsql.class.php | 13 ++++++------- htdocs/exports/class/export.class.php | 4 ++-- test/phpunit/PgsqlTest.php | 12 +++++++++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 4e14c6987c0..5a9a446596f 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -163,10 +163,13 @@ class DoliDBPgsql extends DoliDB } if ($line != "") { - // group_concat support (PgSQL >= 9.1) - $line = preg_replace('/GROUP_CONCAT/i', 'STRING_AGG', $line); + // group_concat support (PgSQL >= 9.0) + // Replace group_concat(x) or group_concat(x SEPARATOR ',') with string_agg(x, ',') + $line = preg_replace('/GROUP_CONCAT/i', 'STRING_AGG', $line); $line = preg_replace('/ SEPARATOR/i', ',', $line); - + $line = preg_replace('/STRING_AGG\(([^,\)]+)\)/i', 'STRING_AGG(\\1, \',\')', $line); + //print $line."\n"; + if ($type == 'auto') { if (preg_match('/ALTER TABLE/i',$line)) $type='dml'; @@ -315,10 +318,6 @@ class DoliDBPgsql extends DoliDB } } - // Replace group_concat(x) with string_agg(x, ',') - $line=preg_replace('/GROUP_CONCAT\(([^\)]+)\)/i','STRING_AGG(\\1, \',\')',$line); - //print $line."\n"; - // Remove () in the tables in FROM if 1 table $line=preg_replace('/FROM\s*\((([a-z_]+)\s+as\s+([a-z_]+)\s*)\)/i','FROM \\1',$line); //print $line."\n"; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 3bf2f87c3b1..496092b7f73 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -241,7 +241,7 @@ class Export // Loop on each condition to add foreach ($array_filterValue as $key => $value) { - if (preg_match('/group_concat/', $key)) continue; + if (preg_match('/GROUP_CONCAT/i', $key)) continue; if ($value != '') $sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); } $sql.=$sqlWhere; @@ -256,7 +256,7 @@ class Export // Loop on each condition to add foreach ($array_filterValue as $key => $value) { - if (preg_match('/group_concat/', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); + if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]); } } diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index f25ea3ea72f..05efcaeb30b 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -162,11 +162,17 @@ class PgsqlTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;'); - // Create a constraint - $sql='SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b'; + // Test GROUP_CONCAT (without SEPARATOR) + $sql="SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b"; $result=DoliDBPgsql::convertSQLFromMysql($sql); print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b"); + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)'); + + // Test GROUP_CONCAT (with SEPARATOR) + $sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b"; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)'); return $result; } From 266fef40ad782e15ef08ace24930aa10c9ed41d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 15:16:32 +0200 Subject: [PATCH 030/144] Add a way to enhance security check. --- htdocs/admin/tools/export.php | 50 ++++++++++++++++++++++++++--------- htdocs/conf/conf.php.example | 39 ++++++++++++++++----------- htdocs/install/step1.php | 16 +++++++---- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 73 insertions(+), 33 deletions(-) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 175aaa65665..5ace954045a 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -53,6 +53,8 @@ if ($file && ! $what) exit; } +$errormsg=''; + /* * Actions @@ -120,16 +122,37 @@ if ($what == 'mysql') { $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg - if ($cmddump) + if (! empty($dolibarr_main_restrict_os_commands)) + { + $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); + $ok=0; + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump); + foreach($arrayofallowedcommand as $allowedcommand) + { + if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump)) + { + $ok=1; + break; + } + } + if (! $ok) + { + $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); + } + } + + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - - $errormsg=$utils->error; - $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; - $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + if (! $errormsg) + { + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + } } // MYSQL NO BIN @@ -146,16 +169,19 @@ if ($what == 'mysqlnobin') if ($what == 'postgresql') { $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg - if ($cmddump) + + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - - $errormsg=$utils->error; - $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; - $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + if (! $errormsg) + { + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; + } $what=''; // Clear to show message to run command } diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 3d6db94d801..928d02140f4 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -220,6 +220,25 @@ $dolibarr_main_authentication='dolibarr'; // $dolibarr_main_force_https='0'; +// dolibarr_main_prod +// When this parameter is defined, all errors messages are not reported. +// This feature exists for production usage to avoid to give any information to hackers. +// Default value: 0 +// Possible values: 0 or 1 +// Examples: +// $dolibarr_main_prod='0'; +// +$dolibarr_main_prod='0'; + +// $dolibarr_main_restrict_os_commands +// To restrict commands you can execute by the backup feature, enter allowed command here. +// Note: If you can, defining permission on OS linux (using SELinux for example) may be a better choice. +// Default value: 'mysqldump, mysql, pg_dump, pgrestore' +// Examples: +// $dolibarr_main_restrict_os_commands='mysqldump, mysqldumpalias'; +// +$dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; + // dolibarr_nocsrfcheck // This parameter can be used to disable CSRF protection. // This might be required if you access Dolibarr behind a proxy that make @@ -231,15 +250,11 @@ $dolibarr_main_force_https='0'; // $dolibarr_nocsrfcheck='0'; -// dolibarr_main_prod -// When this parameter is defined, all errors messages are not reported. -// This feature exists for production usage to avoid to give any information to hackers. -// Default value: 0 -// Possible values: 0 or 1 +// dolibarr_mailing_limit_sendbyweb +// Can set a limit for mailing send by web. Can be used for a restricted mode. +// Default value: 0 (use database value if exist) // Examples: -// $dolibarr_main_prod='0'; -// -$dolibarr_main_prod='0'; +// $dolibarr_mailing_limit_sendbyweb='0'; @@ -251,8 +266,6 @@ $dolibarr_main_prod='0'; // This parameter contains prefix of Dolibarr database. 'llx_' if not defined. // Examples: // $dolibarr_main_db_prefix='llx_'; -// -$dolibarr_main_db_prefix=''; // dolibarr_main_limit_users // Can set a limit on the number of users it will be possible to create @@ -261,12 +274,6 @@ $dolibarr_main_db_prefix=''; // Examples: // $dolibarr_main_limit_users='0'; -// dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. Can be used for a restricted mode. -// Default value: 0 (use database value if exist) -// Examples: -// $dolibarr_mailing_limit_sendbyweb='0'; - // dolibarr_strict_mode // Set this to 1 to enable the PHP strict mode. For dev environment only. // Default value: 0 (use database value if exist) diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 70f1f3422ea..a07dbc48168 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -853,24 +853,30 @@ function write_conf_file($conffile) fputs($fp,"\n"); /* Authentication */ + fputs($fp, '// Authentication settings'); + fputs($fp,"\n"); + fputs($fp, '$dolibarr_main_authentication=\'dolibarr\';'); fputs($fp,"\n\n"); - fputs($fp, '// Specific settings'); + fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';'); fputs($fp,"\n"); - fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';'); + fputs($fp, '// Security settings'); fputs($fp,"\n"); fputs($fp, '$dolibarr_main_prod=\'0\';'); fputs($fp,"\n"); - fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); - fputs($fp,"\n"); - fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';'); fputs($fp,"\n"); + fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore\';'); + fputs($fp,"\n"); + + fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); + fputs($fp,"\n"); + fputs($fp, '$dolibarr_main_cookie_cryptkey=\''.$key.'\';'); fputs($fp,"\n"); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d7936f43c32..b9721946127 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1589,3 +1589,4 @@ DetectionNotPossible=Detection not possible UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access) ListOfAvailableAPIs=List of available APIs activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise +CommandIsNotInsideAllowedCommands=The command you try to run is not inside list of allowed commands defined into parameter $dolibarr_main_restrict_os_commands into conf.php file. \ No newline at end of file From 5898fdb813a15f3568870ca0a8ccadf1802490ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 15:27:16 +0200 Subject: [PATCH 031/144] A more complete example --- htdocs/conf/conf.php.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 928d02140f4..6ca98728312 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -235,7 +235,7 @@ $dolibarr_main_prod='0'; // Note: If you can, defining permission on OS linux (using SELinux for example) may be a better choice. // Default value: 'mysqldump, mysql, pg_dump, pgrestore' // Examples: -// $dolibarr_main_restrict_os_commands='mysqldump, mysqldumpalias'; +// $dolibarr_main_restrict_os_commands='mysqldump, /usr/local/bin/otherdumptool'; // $dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; From a8ba8e612a6d314f28a928da994855dbb64ab05b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 15:56:03 +0200 Subject: [PATCH 032/144] Missing translation --- htdocs/langs/en_US/admin.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b9721946127..df340688a67 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -512,6 +512,8 @@ Module5000Name=Multi-company Module5000Desc=Allows you to manage multiple companies Module6000Name=Workflow Module6000Desc=Workflow management +Module10000Name=Websites +Module10000Desc=Create public websites with a WYSIWG editor. Just setup your web server to point to the dedicated directory to have it online on the Internet. Module20000Name=Leave Requests management Module20000Desc=Declare and follow employees leaves requests Module39000Name=Product lot From f021a8ca310459bec88982c12867e8ffc7a99d95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 18:48:50 +0200 Subject: [PATCH 033/144] FIX Bad error management into trigger of mailmanspip --- htdocs/adherents/card.php | 6 +----- htdocs/adherents/class/adherent.class.php | 11 ++++++----- htdocs/core/class/commonobject.class.php | 3 +-- htdocs/core/class/interfaces.class.php | 4 +++- htdocs/user/card.php | 6 ++++-- htdocs/user/class/user.class.php | 16 ++++++++++------ 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 49048cfaf1f..cc60549f6f6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -404,11 +404,7 @@ if (empty($reshook)) } else { - if ($object->error) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 87ceb66f9d1..29624f9db2c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -509,7 +509,7 @@ class Adherent extends CommonObject if (! $error && $nbrowsaffected) // If something has change in main data { // Update information on linked user if it is an update - if ($this->user_id > 0 && ! $nosyncuser) + if (! $error && $this->user_id > 0 && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -552,7 +552,7 @@ class Adherent extends CommonObject } // Update information on linked thirdparty if it is an update - if ($this->fk_soc > 0 && ! $nosyncthirdparty) + if (! $error && $this->fk_soc > 0 && ! $nosyncthirdparty) { require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -1423,9 +1423,10 @@ class Adherent extends CommonObject $err=0; // mailman - if (! empty($conf->global->ADHERENT_USE_MAILMAN)) + if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_mailman($this); + if ($result < 0) { if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; @@ -1444,7 +1445,7 @@ class Adherent extends CommonObject } // spip - if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) + if (! empty($conf->global->ADHERENT_USE_SPIP) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_spip($this); if ($result < 0) @@ -1458,7 +1459,7 @@ class Adherent extends CommonObject return -$err; } else - { + { return 1; } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 83499a85b3a..620047014d4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3998,14 +3998,13 @@ abstract class CommonObject { if (!empty($this->errors)) { - $this->errors=array_merge($this->errors,$interface->errors); + $this->errors=array_unique(array_merge($this->errors,$interface->errors)); // We use array_unique because when a trigger call another trigger on same object, this->errors is added twice. } else { $this->errors=$interface->errors; } } - return $result; } diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 1ac219029fd..029aaef1116 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -191,10 +191,12 @@ class Interfaces if ($result < 0) { // Action KO + //dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($objMod->errors), LOG_ERR); $nbtotal++; $nbko++; if (! empty($objMod->errors)) $this->errors=array_merge($this->errors,$objMod->errors); else if (! empty($objMod->error)) $this->errors[]=$objMod->error; + //dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($this->errors), LOG_ERR); } } else @@ -205,7 +207,7 @@ class Interfaces if ($nbko) { - dol_syslog(get_class($this)."::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR); + dol_syslog(get_class($this)."::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko." - Nb of error string returned in this->errors = ".count($this->errors), LOG_ERR); return -$nbko; } else diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 28b1040f579..fcc73597754 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -54,6 +54,7 @@ $mode = GETPOST('mode','alpha'); $confirm = GETPOST('confirm','alpha'); $subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); +$cancel = GETPOST('cancel'); // Define value to know what current user can do on users $canadduser=(! empty($user->admin) || $user->rights->user->user->creer); @@ -299,7 +300,8 @@ if (empty($reshook)) { } } - if ($action == 'update' && !$_POST["cancel"]) { + if ($action == 'update' && ! $cancel) + { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if ($caneditfield) // Case we can edit all field @@ -395,7 +397,7 @@ if (empty($reshook)) { if (!$error) { $ret = $object->update($user); if ($ret < 0) { - $error ++; + $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors'); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6a19be4da1e..f998f0e8e1d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1332,14 +1332,14 @@ class User extends CommonObject // If user is linked to a member, remove old link to this member if ($this->fk_member > 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; - dol_syslog(get_class($this)."::update", LOG_DEBUG); + dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG); + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } } // Set link to user + dol_syslog(get_class($this)."::update set link with member", LOG_DEBUG); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member>0?$this->fk_member:'null')." where rowid = ".$this->id; - dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } @@ -1347,6 +1347,8 @@ class User extends CommonObject { if ($this->fk_member > 0 && ! $nosyncmember) { + dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // This user is linked with a member, so we also update members informations @@ -1374,16 +1376,18 @@ class User extends CommonObject $adh->user_login=$this->login; $result=$adh->update($user,0,1); - if ($result < 0) + if ($result < 0) { - $this->error=$luser->error; - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + $this->error=$adh->error; + $this->errors=$adh->errors; + dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); $error++; } } else { $this->error=$adh->error; + $this->errors=$adh->errors; $error++; } } From 09a868af3fe1fdb8d48462a6a94cfaa7e18335af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 21:28:52 +0200 Subject: [PATCH 034/144] FIX: Sync of password must follow same rule 'crypted or not' on both sides (user and member) --- htdocs/adherents/card.php | 8 +++- htdocs/adherents/class/adherent.class.php | 51 ++++++++++++++++------- htdocs/user/class/user.class.php | 8 ++-- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index cc60549f6f6..187fee22dfe 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1439,6 +1439,12 @@ else if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass); + if ($object->pass) print preg_replace('/./i','*',$object->pass); + else + { + if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + else print $langs->trans("Hidden"); + } if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); @@ -1447,7 +1453,7 @@ else } print ''; } - + print ''; print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 29624f9db2c..33e4d0bec0d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -47,8 +47,15 @@ class Adherent extends CommonObject var $mesgs; var $login; - var $pass; - var $societe; + + //! Clear password in memory + var $pass; + //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) + var $pass_indatabase; + //! Encrypted password in database (always defined) + var $pass_indatabase_crypted; + + var $societe; var $company; var $address; var $zip; @@ -482,8 +489,10 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::update update password"); if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { - // Si mot de passe saisi et different de celui en base - $result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncuserpass); + $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1; + + // If password to set differs from the one found into database + $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); if (! $nbrowsaffected) $nbrowsaffected++; } } @@ -810,13 +819,11 @@ class Adherent extends CommonObject $password=getRandomPassword(false); } - // Cryptage mot de passe - if ($isencrypted) - { - // Encryption - $password_indatabase = dol_hash($password); - } - else + // Crypt password + $password_crypted = dol_hash($password); + + $password_indatabase = ''; + if (! $isencrypted) { $password_indatabase = $password; } @@ -824,7 +831,17 @@ class Adherent extends CommonObject $this->db->begin(); // Mise a jour - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; + $sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."'"; + //if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) + if ($isencrypted) + { + $sql.= ", pass = null"; + } + else + { + $sql.= ", pass = '".$this->db->escape($password_indatabase)."'"; + } $sql.= " WHERE rowid = ".$this->id; //dol_syslog("Adherent::Password sql=hidden"); @@ -838,7 +855,8 @@ class Adherent extends CommonObject { $this->pass=$password; $this->pass_indatabase=$password_indatabase; - + $this->pass_indatabase_crypted=$password_crypted; + if ($this->user_id && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1042,7 +1060,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; + $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1087,7 +1105,6 @@ class Adherent extends CommonObject $this->firstname = $obj->firstname; $this->lastname = $obj->lastname; $this->login = $obj->login; - $this->pass = $obj->pass; $this->societe = $obj->company; $this->company = $obj->company; $this->fk_soc = $obj->fk_soc; @@ -1095,6 +1112,10 @@ class Adherent extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; + $this->pass = $obj->pass; + $this->pass_indatabase = $obj->pass; + $this->pass_indatabase_crypted = $obj->pass_crypted; + $this->state_id = $obj->state_id; $this->state_code = $obj->state_id?$obj->state_code:''; $this->state = $obj->state_id?$obj->state:''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f998f0e8e1d..5b79447736e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1362,7 +1362,9 @@ class User extends CommonObject $adh->lastname=$this->lastname; $adh->login=$this->login; $adh->gender=$this->gender; + $adh->pass=$this->pass; + $adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->email=$this->email; @@ -1375,7 +1377,7 @@ class User extends CommonObject $adh->user_id=$this->id; $adh->user_login=$this->login; - $result=$adh->update($user,0,1); + $result=$adh->update($user,0,1,0); if ($result < 0) { $this->error=$adh->error; @@ -1499,7 +1501,7 @@ class User extends CommonObject $password=getRandomPassword(false); } - // Crypte avec md5 + // Crypt password $password_crypted = dol_hash($password); // Mise a jour @@ -1543,7 +1545,7 @@ class User extends CommonObject if ($result >= 0) { - $result=$adh->setPassword($user,$this->pass,0,1); // Cryptage non gere dans module adherent + $result=$adh->setPassword($user,$this->pass,(empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1),1); // Cryptage non gere dans module adherent if ($result < 0) { $this->error=$adh->error; From d23a8a56ea90c791c724a05fe87dd79887665983 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2016 21:40:45 +0200 Subject: [PATCH 035/144] Fix must use the constant, not hard coded value. --- htdocs/categories/class/categorie.class.php | 16 ++++++++-------- htdocs/user/card.php | 2 +- test/phpunit/CategorieTest.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 7c7c35d4b05..8636232b405 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -43,13 +43,13 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; class Categorie extends CommonObject { // Categories types - const TYPE_PRODUCT = 0; - const TYPE_SUPPLIER = 1; - const TYPE_CUSTOMER = 2; - const TYPE_MEMBER = 3; - const TYPE_CONTACT = 4; - const TYPE_USER = 4; // categorie contact and user are same ! - const TYPE_ACCOUNT = 5; // bank account + const TYPE_PRODUCT = 0; // TODO Replace with value 'product' + const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier' + const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer' + const TYPE_MEMBER = 3; // TODO Replace this value with 'member' + const TYPE_CONTACT = 4; // TODO Replace this value with 'contact' + const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user' + const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' /** * @var array ID mapping from type string @@ -63,7 +63,7 @@ class Categorie extends CommonObject 'member' => 3, 'contact' => 4, 'user' => 4, - 'account' => 5, + 'account' => 5, ); /** * @var array Foreign keys mapping from type string diff --git a/htdocs/user/card.php b/htdocs/user/card.php index fcc73597754..b035358716e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2224,7 +2224,7 @@ else print ''; $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 ); $c = new Categorie( $db ); - $cats = $c->containing( $object->id, 'user' ); + $cats = $c->containing($object->id, Categorie::TYPE_USER); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index d9e030ef9ef..574a8d793f9 100644 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -200,7 +200,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase // Get list of categories for product $localcateg=new Categorie($this->savdb); - $listofcateg=$localcateg->containing($localobject2->id, 'product', 'label'); + $listofcateg=$localcateg->containing($localobject2->id, Categorie::TYPE_PRODUCT, 'label'); $this->assertTrue(in_array('Specimen Category for product',$listofcateg), 'Categ not found linked to product when it should'); return $id; From 8878c737324c62f5e5dccb03baaea1bffc9ce07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2016 12:07:24 +0200 Subject: [PATCH 036/144] Fix: link to other elements must be at end everywhere --- htdocs/adherents/card.php | 48 +++++++------- htdocs/adherents/card_subscriptions.php | 48 +++++++------- htdocs/user/card.php | 86 ++++++++++++------------- 3 files changed, 91 insertions(+), 91 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 187fee22dfe..ac09e1864b6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1485,6 +1485,30 @@ else print $object->showOptionals($extrafields, 'view', $parameters); } + // Date end subscription + print ''.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + } + print ''; + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -1555,30 +1579,6 @@ else } print ''; - // Date end subscription - print ''.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) - { - print dol_print_date($object->datefin,'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - if (! $adht->cotisation) - { - print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - else - { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - } - print ''; - print "\n"; print "\n"; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index dcc8b671259..1299f2400dc 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -652,6 +652,30 @@ if ($rowid > 0) print $object->showOptionals($extrafields, 'view', $parameters); } + // Date end subscription + print ''.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + } + print ''; + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -722,30 +746,6 @@ if ($rowid > 0) } print ''; - // Date end subscription - print ''.$langs->trans("SubscriptionEndDate").''; - if ($object->datefin) - { - print dol_print_date($object->datefin,'day'); - if ($object->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - if (! $adht->cotisation) - { - print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - else - { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - } - print ''; - print "\n"; print "\n"; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index b035358716e..032628e4e67 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1442,6 +1442,49 @@ else print ''; } + // Multicompany + // TODO This should be done with hook formObjectOption + if (is_object($mc)) + { + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print ''.$langs->trans("Entity").''; + if (empty($object->entity)) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "\n"; + } + } + + if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) + { + print ''.$langs->trans("OpenIDURL").''; + print ''.$object->openid.''; + print "\n"; + } + + print ''.$langs->trans("LastConnexion").''; + print ''.dol_print_date($object->datelastlogin,"dayhour").''; + print "\n"; + + print ''.$langs->trans("PreviousConnexion").''; + print ''.dol_print_date($object->datepreviouslogin,"dayhour").''; + print "\n"; + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields); + } + // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1490,49 +1533,6 @@ else print ''."\n"; } - // Multicompany - // TODO This should be done with hook formObjectOption - if (is_object($mc)) - { - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print ''.$langs->trans("Entity").''; - if (empty($object->entity)) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "\n"; - } - } - - if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) - { - print ''.$langs->trans("OpenIDURL").''; - print ''.$object->openid.''; - print "\n"; - } - - print ''.$langs->trans("LastConnexion").''; - print ''.dol_print_date($object->datelastlogin,"dayhour").''; - print "\n"; - - print ''.$langs->trans("PreviousConnexion").''; - print ''.dol_print_date($object->datepreviouslogin,"dayhour").''; - print "\n"; - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields); - } - print "\n"; print ''; From bc38bc63ca9af954711748ad0d24ec3cff013594 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2016 21:18:44 +0200 Subject: [PATCH 037/144] Fix minor bug in direct printing with google cloud print --- dev/translation/sanity_check_en_langfiles.php | 3 +++ htdocs/core/actions_printing.inc.php | 12 +++++++----- htdocs/langs/en_US/printing.lang | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index cd652374489..f64798d72ff 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -316,6 +316,9 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^EMailText/', $value)) $qualifiedforclean=0; if (preg_match('/ById$/', $value)) $qualifiedforclean=0; if (preg_match('/ByLogin$/', $value)) $qualifiedforclean=0; + // printing + if (preg_match('/PrintingDriverDesc$/', $value)) $qualifiedforclean=0; + if (preg_match('/PrintTestDesc$/', $value)) $qualifiedforclean=0; // products if (preg_match('/GlobalVariableUpdaterType$/', $value)) $qualifiedforclean=0; if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0; diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 5f04e42cc9b..061b98d1e9c 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Frederic France +/* Copyright (C) 2014-2016 Laurent Destailleur + * Copyright (C) 2014 Frederic France * * 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 @@ -44,7 +44,8 @@ if ($action == 'print_file' and $user->rights->printing->read) $printer = new $classname($db); //print '
'.print_r($printer, true).'
'; - if (! empty($conf->global->{$printer->active})) { + if (! empty($conf->global->{$printer->active})) + { $subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':''); $module = GETPOST('printer', 'alpha'); if ($module =='commande_fournisseur') { @@ -56,10 +57,11 @@ if ($action == 'print_file' and $user->rights->printing->read) //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors, 'errors'); } - if ($ret==0) { + if ($ret==0) + { //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name, null); + setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); $printed++; } } diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index 14577a126e4..2da614e96f9 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -51,3 +51,5 @@ IPP_Supported=Type of media DirectPrintingJobsDesc=This page lists printing jobs found for available printers. GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret. GoogleAuthConfigured=Google OAuth credentials found into setup of module OAuth. +PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print. +PrintTestDescprintgcp=List of Printers for Google Cloud Print. From d6e15fe8f38bc2a61e4d1bbf463c83920cbd7926 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2016 23:15:20 +0200 Subject: [PATCH 038/144] Increase max size of number of product into list --- htdocs/cashdesk/include/environnement.php | 2 +- htdocs/core/class/conf.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 3e6a88f252a..4490d4cf405 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -44,7 +44,7 @@ $conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSIO // View parameters -$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?500:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes +$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?1000:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes // Add hidden option to force decrease of stock whatever is user setup diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 35b0d4024ec..4002f437ede 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -429,7 +429,7 @@ class Conf $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; // conf->product->limit_size = constante de taille maximale des select de produit - if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100; + if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=1000; $this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE; // conf->theme et $this->css From 25b8657183f7473114c61d68e4d6d583fcb36357 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jun 2016 23:22:39 +0200 Subject: [PATCH 039/144] Fix bad doc --- COPYRIGHT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYRIGHT b/COPYRIGHT index b8cf93e595a..4e43541fa60 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -40,7 +40,7 @@ jQuery blockUI 2.70.0 GPL and MIT License Yes jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery DataTables 1.9.4 BSD Yes JS library for tables output jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files -jQuery Flot 0.7 MIT License Yes JS library to build graph +jQuery Flot 0.8.3 MIT License Yes JS library to build graph jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups) From eb9d26a9e0fa38673db05beced0b1485875067cb Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 27 Jun 2016 11:36:13 +0200 Subject: [PATCH 040/144] FIX #5383 bad object id on don delete --- htdocs/don/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index b56171b8796..cc27b1bcfd1 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -740,9 +740,9 @@ if (! empty($id) && $action != 'edit') // Delete if ($user->rights->don->supprimer) { - if ($don->statut == -1 || $don->statut == 0) + if ($object->statut == -1 || $object->statut == 0) { - print '"; + print '"; } else { From d0be7877d376841141f759bcd6789d46c3f73ed1 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 27 Jun 2016 13:57:10 +0200 Subject: [PATCH 041/144] Fix box PHP strict warning --- htdocs/core/boxes/box_actions.php | 57 +++++++++++-------- htdocs/core/boxes/box_activity.php | 7 ++- htdocs/core/boxes/box_bookmarks.php | 7 ++- htdocs/core/boxes/box_clients.php | 7 ++- htdocs/core/boxes/box_commandes.php | 5 +- htdocs/core/boxes/box_comptes.php | 7 ++- htdocs/core/boxes/box_contacts.php | 15 ++--- htdocs/core/boxes/box_contracts.php | 15 ++--- htdocs/core/boxes/box_external_rss.php | 5 +- htdocs/core/boxes/box_factures.php | 9 +-- htdocs/core/boxes/box_factures_fourn.php | 7 ++- htdocs/core/boxes/box_factures_fourn_imp.php | 7 ++- htdocs/core/boxes/box_factures_imp.php | 7 ++- htdocs/core/boxes/box_ficheinter.php | 7 ++- htdocs/core/boxes/box_fournisseurs.php | 5 +- htdocs/core/boxes/box_goodcustomers.php | 11 ++-- .../boxes/box_graph_invoices_permonth.php | 9 +-- .../box_graph_invoices_supplier_permonth.php | 9 +-- .../core/boxes/box_graph_orders_permonth.php | 9 +-- .../box_graph_orders_supplier_permonth.php | 9 +-- .../boxes/box_graph_product_distribution.php | 7 ++- .../boxes/box_graph_propales_permonth.php | 7 ++- htdocs/core/boxes/box_members.php | 7 ++- htdocs/core/boxes/box_produits.php | 7 ++- .../core/boxes/box_produits_alerte_stock.php | 7 ++- htdocs/core/boxes/box_project.php | 7 ++- htdocs/core/boxes/box_propales.php | 5 +- htdocs/core/boxes/box_prospect.php | 7 ++- htdocs/core/boxes/box_services_contracts.php | 17 +++--- htdocs/core/boxes/box_services_expired.php | 8 ++- htdocs/core/boxes/box_supplier_orders.php | 10 ++-- htdocs/core/boxes/box_task.php | 9 +-- 32 files changed, 176 insertions(+), 136 deletions(-) diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 1f5e8493d7b..82aacf2d8a0 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -167,13 +167,15 @@ class box_actions extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { + function showBox($head = null, $contents = null, $nooutput=0) + { global $langs, $conf; parent::showBox($this->info_box_head, $this->info_box_contents); - if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) + $out=''; + if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE)) { $actioncejour=false; $contents=$this->info_box_contents; @@ -183,8 +185,8 @@ class box_actions extends ModeleBoxes $bcx[1] = 'class="box_impair"'; if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) { - print '
trans("ActionsToDo").'">'; - print ''; + $out.= '
trans("ActionsToDo").'">'; + $out.= '
'; for ($line=0, $n=$nblines; $line < $n; $line++) { if (isset($contents[$line])) @@ -202,40 +204,45 @@ class box_actions extends ModeleBoxes $urlsoc=$contents[$line][3]['url']; $dateligne=$contents[$line][4]['text']; $percentage=$contents[$line][5]['text']; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; + $out.= ''; } } - print '
'; - print img_object("",$logo); - print ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + $out.= img_object("",$logo); + $out.= ''.$label.''.img_object("",$logosoc)." ".$nomsoc.''.$dateligne.''.$percentage.'
'; + $out.= ''; } - print '
'; + $out.= ''; if ($actioncejour) { - print ''; + $out.= ''; } else { - print ''; + $out.= ''; } } + + if ($nooutput) return $out; + else print $out; + + return ''; } } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index f7e09d33583..34666507488 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -455,10 +455,11 @@ class box_activity extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 88adb744ceb..e99a0b30387 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -135,11 +135,12 @@ class box_bookmarks extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 24c940fb9ea..307dcc7cbfd 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -157,11 +157,12 @@ class box_clients extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 6eb5006182c..7653206333d 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -176,11 +176,12 @@ class box_commandes extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 178851466be..a6b8e2744a6 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -169,11 +169,12 @@ class box_comptes extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index a1fc2768ba1..45963af9bb1 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -83,7 +83,7 @@ class box_contacts extends ModeleBoxes $societestatic=new Societe($db); $line = 0; - while ($line < $num) + while ($line < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); @@ -100,7 +100,7 @@ class box_contacts extends ModeleBoxes $contactstatic->address = $objp->address; $contactstatic->zip = $objp->zip; $contactstatic->town = $objp->town; - + $societestatic->id = $objp->fk_soc; $societestatic->name = $objp->socname; $societestatic->name_alias = $objp->name_alias; @@ -108,7 +108,7 @@ class box_contacts extends ModeleBoxes $societestatic->code_fournisseur = $objp->code_fournisseur; $societestatic->client = $objp->client; $societestatic->fournisseur = $objp->fournisseur; - + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', 'text' => $contactstatic->getNomUrl(1), @@ -131,7 +131,7 @@ class box_contacts extends ModeleBoxes 'text' => $contactstatic->getLibStatut(3), 'asis'=>1, ); - + $line++; } @@ -163,11 +163,12 @@ class box_contacts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 665bff4c6da..40cc8885f90 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -55,14 +55,14 @@ class box_contracts extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts",$max)); if ($user->rights->contrat->lire) { $contractstatic=new Contrat($db); $thirdpartytmp=new Societe($db); - + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; @@ -83,8 +83,8 @@ class box_contracts extends ModeleBoxes $line = 0; $langs->load("contracts"); - - while ($line < $num) + + while ($line < $num) { $objp = $db->fetch_object($resql); $datec=$db->jdate($objp->datec); @@ -99,7 +99,7 @@ class box_contracts extends ModeleBoxes $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; - + // fin_validite is no more on contract but on services // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } @@ -157,11 +157,12 @@ class box_contracts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index f1db35e1614..dbe71a6ca41 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -184,11 +184,12 @@ class box_external_rss extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 7b5a01d6bca..22a90929a0b 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -180,11 +180,12 @@ class box_factures extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @return void + * @param int $nooutput No print, only return string + * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 88b64947f05..b43d9cfc47b 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -189,11 +189,12 @@ class box_factures_fourn extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 27441f22ea5..b3ca0fec031 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -186,11 +186,12 @@ class box_factures_fourn_imp extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index bcc26f60e4c..67c4d4dbfcc 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -182,11 +182,12 @@ class box_factures_imp extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index decf5e564f0..d57a2a991df 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -144,11 +144,12 @@ class box_ficheinter extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index e3e6061d803..ed3680af455 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -139,11 +139,12 @@ class box_fournisseurs extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 579df4762a0..56aa9097ac2 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -81,7 +81,7 @@ class box_goodcustomers extends ModeleBoxes if ($user->rights->societe->lire) { - + $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.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; @@ -127,7 +127,7 @@ class box_goodcustomers extends ModeleBoxes 'td' => 'align="right"', 'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'') ); - + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status,3) @@ -158,11 +158,12 @@ class box_goodcustomers extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 3848960e5e9..1b54d917d05 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -171,7 +171,7 @@ class box_graph_invoices_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); @@ -263,11 +263,12 @@ class box_graph_invoices_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 0931d2d05df..c7856d619f6 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -170,7 +170,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes if (! $mesg) { $langs->load("bills"); - + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); @@ -262,11 +262,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 4f86dcd0b8b..4a0f0a7d5b1 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -90,7 +90,7 @@ class box_graph_orders_permonth extends ModeleBoxes if ($user->rights->commande->lire) { $langs->load("orders"); - + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; @@ -263,11 +263,12 @@ class box_graph_orders_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 6df7d81766c..2ab14bb4502 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -89,7 +89,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes if ($user->rights->fournisseur->commande->lire) { $langs->load("orders"); - + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; @@ -262,11 +262,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 46ddccc2a1d..48168eadb53 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -390,11 +390,12 @@ class box_graph_product_distribution extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 8ef7b25969f..0ae61938ce7 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -264,11 +264,12 @@ class box_graph_propales_permonth extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 9c166aac866..d5d8f1243f5 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -169,11 +169,12 @@ class box_members extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index c8ef1b5f558..5cce3254bfb 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -192,11 +192,12 @@ class box_produits extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5a718b79696..4d79abd156b 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -199,11 +199,12 @@ class box_produits_alerte_stock extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 7d819ec0d2b..8733f3ed8ce 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -173,11 +173,12 @@ class box_project extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index c14cf07a51c..b0a1e4a3798 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -166,11 +166,12 @@ class box_propales extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 3895a27a9f1..40adb98b405 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -167,11 +167,12 @@ class box_prospect extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 802dee8474f..b45bde124a3 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -64,7 +64,7 @@ class box_services_contracts extends ModeleBoxes $contractstatic=new Contrat($db); $contratlignestatic=new ContratLigne($db); $thirdpartytmp = new Societe($db); - + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as contract_status,"; $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,"; @@ -103,14 +103,14 @@ class box_services_contracts extends ModeleBoxes $contratlignestatic->type=$objp->type; $contratlignestatic->product_id=$objp->product_id; $contratlignestatic->product_ref=$objp->product_ref; - + $contractstatic->statut=$objp->contract_status; $contractstatic->id=$objp->rowid; $contractstatic->ref=$objp->ref; - + $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; - + // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { @@ -132,7 +132,7 @@ class box_services_contracts extends ModeleBoxes 'text' => $contratlignestatic->getNomUrl(1), 'asis' => 1 ); - + $this->info_box_contents[$i][] = array('td' => 'align="left"', 'text' => $contractstatic->getNomUrl(1), 'asis' => 1 @@ -175,11 +175,12 @@ class box_services_contracts extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); + function showBox($head = null, $contents = null, $nooutput=0) + { + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 296ef56af8a..1e39b286ee9 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -118,7 +118,7 @@ class box_services_expired extends ModeleBoxes $i++; } - if ($num==0) + if ($num==0) { $langs->load("contracts"); $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices")); @@ -147,11 +147,13 @@ class box_services_expired extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 84521bf4ee0..26061de5bf8 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -171,11 +171,13 @@ class box_supplier_orders extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @return void - */ - function showBox($head = null, $contents = null) + * @param int $nooutput No print, only return string + * @param int $nooutput No print, only return string + * @return void + */ + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d314af73cd1..29dd9390597 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -91,11 +91,11 @@ class box_task extends ModeleBoxes $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) + if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) + while ($i < $num) { $objp = $db->fetch_object($result); $this->info_box_contents[$i][] = array( @@ -137,10 +137,11 @@ class box_task extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null) + function showBox($head = null, $contents = null, $nooutput=0) { - parent::showBox($this->info_box_head, $this->info_box_contents); + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } From 9ec31aea0a179d6df265b246ba8ed409cf6def3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jun 2016 15:28:19 +0200 Subject: [PATCH 042/144] Use a more common translation --- htdocs/langs/en_US/products.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index a6f2ba51f23..830fe3f3eb1 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -83,7 +83,7 @@ SetDefaultBarcodeType=Set barcode type BarcodeValue=Barcode value NoteNotVisibleOnBill=Note (not visible on invoices, proposals...) ServiceLimitedDuration=If product is a service with limited duration: -MultiPricesAbility=Several level of prices per product/service +MultiPricesAbility=Several segment of prices per product/service (each customer is in one segment) MultiPricesNumPrices=Number of prices AssociatedProductsAbility=Activate the package feature AssociatedProducts=Package product @@ -174,13 +174,13 @@ AlwaysUseNewPrice=Always use current price of product/service AlwaysUseFixedPrice=Use the fixed price PriceByQuantity=Different prices by quantity PriceByQuantityRange=Quantity range -MultipriceRules=Price level rules -UseMultipriceRules=Use price level rules (defined into product module setup) to autocalculate prices of all other level according to first level +MultipriceRules=Price segment rules +UseMultipriceRules=Use price segment rules (defined into product module setup) to autocalculate prices of all other segment according to first segment PercentVariationOver=%% variation over %s PercentDiscountOver=%% discount over %s ### composition fabrication Build=Produce -ProductsMultiPrice=Products and prices for each price level +ProductsMultiPrice=Products and prices for each price segment ProductsOrServiceMultiPrice=Customer prices (of products or services, multi-prices) ProductSellByQuarterHT=Products turnover quarterly before tax ServiceSellByQuarterHT=Services turnover quarterly before tax From 7d2d38d7b50c6d2332ca72e5ce2d4ab7913e3296 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jun 2016 16:16:28 +0200 Subject: [PATCH 043/144] Maj trad --- htdocs/langs/en_US/products.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 830fe3f3eb1..b1b8d601430 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -201,9 +201,9 @@ DefinitionOfBarCodeForThirdpartyNotComplete=Definition of type or value of bar c BarCodeDataForProduct=Barcode information of product %s : BarCodeDataForThirdparty=Barcode information of thirdparty %s : ResetBarcodeForAllRecords=Define barcode value for all records (this will also reset barcode value already defined with new values) -PriceByCustomer=Different price for each customer -PriceCatalogue=Unique price per product/service -PricingRule=Rules for customer prices +PriceByCustomer=Different prices for each customer +PriceCatalogue=A single sell price per product/service +PricingRule=Rules for sell prices AddCustomerPrice=Add price by customer ForceUpdateChildPriceSoc=Set same price on customer subsidiaries PriceByCustomerLog=Log of previous customer prices From 29fa49c99d8662b54e819416a67b8f14e6680810 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 01:50:27 +0200 Subject: [PATCH 044/144] Prepare package 4.0 --- ChangeLog | 2 +- build/makepack-dolibarr.pl | 22 ++++++++++++++++++++-- build/rpm/dolibarr_fedora.spec | 2 ++ build/rpm/dolibarr_generic.spec | 2 ++ build/rpm/dolibarr_mandriva.spec | 2 ++ build/rpm/dolibarr_opensuse.spec | 2 ++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3d40f3a04c..2510764c349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,7 +12,7 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. -***** ChangeLog for 4.0 compared to 3.9.* ***** +***** ChangeLog for 4.0.0 compared to 3.9.* ***** For users: NEW: Add reccuring invoice feature and automatic generation of invoices. diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 45c8e0a6f42..b6c86a7a119 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -53,7 +53,7 @@ if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake use vars qw/ $REVISION $VERSION /; -$VERSION="3.3"; +$VERSION="4.0"; @@ -356,6 +356,7 @@ if ($nboftargetok) { # Test that the ChangeLog is ok $TMPBUILDTOCHECKCHANGELOG=$BUILD; $TMPBUILDTOCHECKCHANGELOG =~ s/\-rc\d*//; + $TMPBUILDTOCHECKCHANGELOG =~ s/\-beta\d*//; print "Check if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n"; $ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`; if (! $ret) @@ -458,6 +459,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdemo`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; @@ -1121,7 +1123,7 @@ if ($nboftargetok) { { if ($CHOOSEDPUBLISH{$target} < 0) { next; } - print "\nList of files to publish\n"; + print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', @@ -1136,6 +1138,22 @@ if ($nboftargetok) { "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', "$DESTI/standard/$FILENAMETGZ.zip"=>'standard' ); + if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { # Not stable + %filestoscansf=( + "$DESTI/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', + "$DESTI/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', + "$DESTI/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', + "$DESTI/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' + ); + %filestoscanstableasso=( + "$DESTI/$FILENAMERPM"=>'', + "$DESTI/${FILENAMEDEB}_all.deb"=>'', + "$DESTI/$FILENAMEEXEDOLIWAMP.exe"=>'', + "$DESTI/$FILENAMETGZ.tgz"=>'', + "$DESTI/$FILENAMETGZ.zip"=>'' + ); + } use POSIX qw/strftime/; foreach my $file (sort keys %filestoscansf) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 0cd72f99cdd..4ad1441104d 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -192,6 +192,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -206,6 +207,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 043088bf5d6..f20b2047225 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -272,6 +272,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -286,6 +287,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 3f439bb4a9a..ca836bc47d6 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -189,6 +189,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -203,6 +204,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index cc21d7083b3..fcff3363213 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -200,6 +200,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/margin +%_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal @@ -214,6 +215,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/theme %_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/webservices +%_datadir/dolibarr/htdocs/websites %_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.php From 1a3bd97a557aab2276e96d6efd769a9e842f13ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 02:07:39 +0200 Subject: [PATCH 045/144] Prepare 4.0 doliwamp --- build/exe/doliwamp/doliwamp.iss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 8c6130437ac..31b5b552d21 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -101,6 +101,7 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi ; Put here path of Wampserver applications ; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 or 5.1.36 ; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36 +; Value ???: apache 2.4.19, php 5.5.12, mysql 5.6.17 Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange" Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" @@ -109,7 +110,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\m Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db" ; Dolibarr Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php" -Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" +Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png" Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php" Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock" From 5aa561598f3a119df1fde8fbbdd35def7b945980 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 02:22:01 +0200 Subject: [PATCH 046/144] Fix exit into functions --- htdocs/core/class/translate.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index c0757de2d6b..06bd6dc0c40 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -167,7 +167,7 @@ class Translate if (empty($domain)) { dol_print_error('',get_class($this)."::Load ErrorWrongParameters"); - exit; + return -1; } if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys From b529a535016b806ae35878afd79ed31437cbaed2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 02:36:40 +0200 Subject: [PATCH 047/144] Fix var not initialized --- htdocs/comm/propal/class/propal.class.php | 3 ++- htdocs/commande/class/commande.class.php | 20 +++++-------------- .../facture/class/facture-rec.class.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 2 ++ htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/expedition/class/expedition.class.php | 3 ++- .../fourn/class/fournisseur.facture.class.php | 3 ++- htdocs/livraison/class/livraison.class.php | 3 ++- .../class/supplier_proposal.class.php | 3 ++- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 43416875d95..ffc412fba70 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2611,7 +2611,8 @@ class Propal extends CommonObject { global $langs; - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8fcc7d41ef1..6f14d407a5d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -449,6 +449,8 @@ class Commande extends CommonOrder // If stock is decremented on validate order, we must reincrement it if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { + $result = 0; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -460,22 +462,9 @@ class Commande extends CommonOrder $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; $this->error=$mouvP->error; break; } } } - - if (!$error) - { - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return $result; - } - else - { - $this->error=$mouvP->error; - $this->db->rollback(); - return $result; - } } if (!$error) { @@ -3258,7 +3247,8 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::initAsSpecimen"); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2bcd227827e..1cf7bbf1c6e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -760,8 +760,9 @@ class FactureRec extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - $prodids = array(); + // Load array of products prodids $num_prods = 0; + $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 95d24d2ce06..aa51c63374d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3537,6 +3537,8 @@ class Facture extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 47cde8e3f40..fd92db95dfc 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2098,6 +2098,8 @@ class Contrat extends CommonObject { global $user,$langs,$conf; + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; @@ -2116,8 +2118,6 @@ class Contrat extends CommonObject } } - - // Initialise parametres $this->id=0; $this->specimen=1; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 643ad6995a9..814b517ed38 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1549,7 +1549,8 @@ class Expedition extends CommonObject dol_syslog(get_class($this)."::initAsSpecimen"); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 69932f0c232..8c1a86b03a5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1647,7 +1647,8 @@ class FactureFournisseur extends CommonInvoice $now = dol_now(); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index f77239535a6..45e86b50686 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -833,7 +833,8 @@ class Livraison extends CommonObject $now=dol_now(); - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index fd7f266e159..00efb287dcc 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2186,7 +2186,8 @@ class SupplierProposal extends CommonObject { global $user,$langs,$conf; - // Charge tableau des produits prodids + // Load array of products prodids + $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; From 9b1caefbf9c68ba433333efbeb125cb15d4b10dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 02:40:42 +0200 Subject: [PATCH 048/144] Fix bad var --- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/fourn/commande/orderstoinvoice.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bcbe3ea408e..64c52764599 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -72,7 +72,7 @@ $date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date if ($action == 'create') { - if (is_array($selected) == false) + if (! is_array($selected)) { $error++; setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 64f6aa4dff0..33c3e268565 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -71,11 +71,12 @@ $date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_e $date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]); -if ($action == 'create') { - if (is_array($selected) == false) { - $mesgs = array ( - '
' . $langs->trans('Error_OrderNotChecked') . '
' - ); +if ($action == 'create') +{ + if (! is_array($selected)) + { + $error++; + setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); } else { $origin = GETPOST('origin'); $originid = GETPOST('originid'); @@ -87,11 +88,12 @@ include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('orderstoinvoicesupplier')); + /* * Actions */ -if (($action == 'create' || $action == 'add') && empty($mesgs)) { +if (($action == 'create' || $action == 'add') && ! $error) { require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; if (! empty($conf->projet->enabled)) From 1fdd43452828b81978807187f8ced2698ee58892 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 28 Jun 2016 09:52:27 +0200 Subject: [PATCH 049/144] fix travis --- htdocs/core/boxes/box_services_expired.php | 1 - htdocs/core/boxes/box_supplier_orders.php | 1 - 2 files changed, 2 deletions(-) diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 1e39b286ee9..29db63054e5 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -148,7 +148,6 @@ class box_services_expired extends ModeleBoxes * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines * @param int $nooutput No print, only return string - * @param int $nooutput No print, only return string * @return void */ function showBox($head = null, $contents = null, $nooutput=0) diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 26061de5bf8..1f0e1ece2ef 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -171,7 +171,6 @@ class box_supplier_orders extends ModeleBoxes * * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines - * @param int $nooutput No print, only return string * @param int $nooutput No print, only return string * @return void */ From d9035e53089f4cc2599f54a7852daf3c657d67dd Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 28 Jun 2016 11:41:23 +0200 Subject: [PATCH 050/144] FIX : receiving link never works --- htdocs/core/lib/sendings.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 1c0c589870e..f95fd5dbe76 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -302,7 +302,9 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $expedition->id=$objp->sendingid; $expedition->fetchObjectLinked($expedition->id,$expedition->element); //var_dump($expedition->linkedObjects); - $receiving=(! empty($expedition->linkedObjects['delivery'][0])?$expedition->linkedObjects['delivery'][0]:''); + reset($expedition->linkedObjects['delivery']); + $first = key($expedition->linkedObjects['delivery']); + $receiving=(! empty($expedition->linkedObjects['delivery'][$first])?$expedition->linkedObjects['delivery'][$first]:''); if (! empty($receiving)) { From 7e8506e25ff3579cd54bb360ff52114a1726899e Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 28 Jun 2016 13:25:47 +0200 Subject: [PATCH 051/144] FIX #5338 use of not initialized var $aphour, $apmin, etc --- htdocs/comm/action/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5b013e7a57c..e54fd788a92 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -61,8 +61,14 @@ $originid=GETPOST('originid','int'); $confirm = GETPOST('confirm', 'alpha'); $fulldayevent=GETPOST('fullday'); -$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); -$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); + +$aphour = GETPOST('aphour'); +$apmin = GETPOST('apmin'); +$p2hour = GETPOST('p2hour'); +$p2min = GETPOST('p2min'); + +$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); +$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); // Security check $socid = GETPOST('socid','int'); @@ -92,7 +98,6 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('actioncard','globalcard')); - /* * Actions */ From 2c97d0855a49a2ae9c189dc4d584e33b3c061f7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 17:51:29 +0200 Subject: [PATCH 052/144] Fix: On template invoice, edition of line was not complete. --- .../facture/class/facture-rec.class.php | 107 ++++++++++- htdocs/compta/facture/fiche-rec.php | 166 +++++++++++++++++- 2 files changed, 269 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 1cf7bbf1c6e..357835fbb77 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -509,7 +509,7 @@ class FactureRec extends CommonInvoice $facid=$this->id; - dol_syslog("FactureRec::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); + dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Check parameters @@ -604,6 +604,111 @@ class FactureRec extends CommonInvoice } } + /** + * Update a line to invoice + * + * @param int $rowid Id of line to update + * @param string $desc Description de la ligne + * @param double $pu_ht Prix unitaire HT (> 0 even for credit note) + * @param double $qty Quantite + * @param double $txtva Taux de tva force, sinon -1 + * @param int $fk_product Id du produit/service predefini + * @param double $remise_percent Pourcentage de remise de la ligne + * @param string $price_base_type HT or TTC + * @param int $info_bits Bits de type de lignes + * @param int $fk_remise_except Id remise + * @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note) + * @param int $type Type of line (0=product, 1=service) + * @param int $rang Position of line + * @param int $special_code Special code + * @param string $label Label of the line + * @param string $fk_unit Unit + * @return int <0 if KO, Id of line if OK + */ + function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null) + { + global $mysoc; + + $facid=$this->id; + + dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + + // Check parameters + if ($type < 0) return -1; + + if ($this->brouillon) + { + // Clean parameters + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + if (! $qty) $qty=1; + if (! $info_bits) $info_bits=0; + $pu_ht=price2num($pu_ht); + $pu_ttc=price2num($pu_ttc); + $txtva=price2num($txtva); + + if ($price_base_type=='HT') + { + $pu=$pu_ht; + } + else + { + $pu=$pu_ttc; + } + + // Calcul du total TTC et de la TVA pour la ligne a partir de + // qty, pu, remise_percent et txtva + // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker + // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc); + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + + $product_type=$type; + if ($fk_product) + { + $product=new Product($this->db); + $result=$product->fetch($fk_product); + $product_type=$product->type; + } + + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET "; + $sql.= "fk_facture = '".$facid."'"; + $sql.= ", label=".(! empty($label)?"'".$this->db->escape($label)."'":"null"); + $sql.= ", description='".$this->db->escape($desc)."'"; + $sql.= ", price=".price2num($pu_ht); + $sql.= ", qty=".price2num($qty); + $sql.= ", tva_tx=".price2num($txtva); + $sql.= ", fk_product=".(! empty($fk_product)?"'".$fk_product."'":"null"); + $sql.= ", product_type=".$product_type; + $sql.= ", remise_percent='".price2num($remise_percent)."'"; + $sql.= ", subprice='".price2num($pu_ht)."'"; + $sql.= ", total_ht='".price2num($total_ht)."'"; + $sql.= ", total_tva='".price2num($total_tva)."'"; + $sql.= ", total_ttc='".price2num($total_ttc)."'"; + $sql.= ", rang=".$rang; + $sql.= ", special_code=".$special_code; + $sql.= ", fk_unit=".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null"); + $sql.= " WHERE rowid = ".$rowid; + + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->id=$facid; + $this->update_price(); + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } + } + + /** * Return the next date of * diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 7b2d7076aca..198b08cb451 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -552,9 +552,9 @@ if ($action == 'addline' && $user->rights->facture->creer) if ($result > 0) { - // Define output language /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); @@ -615,8 +615,168 @@ if ($action == 'addline' && $user->rights->facture->creer) } } +elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) +{ + if (! $object->fetch($id) > 0) dol_print_error($db); + $object->fetch_thirdparty(); + + // Clean parameters + $date_start = ''; + $date_end = ''; + //$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); + //$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc')); + $pu_ht = GETPOST('price_ht'); + $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $qty = GETPOST('qty'); + + // Define info_bits + $info_bits = 0; + if (preg_match('/\*/', $vat_rate)) + $info_bits |= 0x01; + + // Define vat_rate + $vat_rate = str_replace('*', '', $vat_rate); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); + + // Add buying price + $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); + $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value + + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + // Unset extrafield + if (is_array($extralabelsline)) { + // Get extra fields + foreach ($extralabelsline as $key => $value) { + unset($_POST["options_" . $key]); + } + } + + // Define special_code for special lines + $special_code=GETPOST('special_code'); + if (! GETPOST('qty')) $special_code=3; + + /*$line = new FactureLigne($db); + $line->fetch(GETPOST('lineid')); + $percent = $line->get_prev_progress($object->id); + + if (GETPOST('progress') < $percent) + { + $mesg = '
' . $langs->trans("CantBeLessThanMinPercent") . '
'; + setEventMessages($mesg, null, 'warnings'); + $error++; + $result = -1; + }*/ + + // Check minimum price + $productid = GETPOST('productid', 'int'); + if (! empty($productid)) + { + $product = new Product($db); + $product->fetch($productid); + + $type = $product->type; + + $price_min = $product->price_min; + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) + $price_min = $product->multiprices_min [$object->thirdparty->price_level]; + + $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); + + // Check price is not lower than minimum (check is done only for standard or replacement invoices) + if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { + setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); + $error ++; + } + } else { + $type = GETPOST('type'); + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + + // Check parameters + if (GETPOST('type') < 0) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + $error ++; + } + } + if ($qty < 0) { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + $error ++; + } + + // Update line + if (! $error) { + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, + $vat_rate, GETPOST('productid'), GETPOST('remise_percent'), 'HT', $info_bits, 0, 0, $type, + 0, $special_code, $label, GETPOST('units')); + + if ($result >= 0) { + /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) + $newlang = GETPOST('lang_id'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + }*/ + + $object->fetch($object->id); // Reload lines + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['productid']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + + unset($_POST['dp_desc']); + unset($_POST['idprod']); + unset($_POST['units']); + + unset($_POST['date_starthour']); + unset($_POST['date_startmin']); + unset($_POST['date_startsec']); + unset($_POST['date_startday']); + unset($_POST['date_startmonth']); + unset($_POST['date_startyear']); + unset($_POST['date_endhour']); + unset($_POST['date_endmin']); + unset($_POST['date_endsec']); + unset($_POST['date_endday']); + unset($_POST['date_endmonth']); + unset($_POST['date_endyear']); + + unset($_POST['situations']); + unset($_POST['progress']); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } +} + // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_ref=''; $search_societe=''; @@ -1302,7 +1462,7 @@ else // Show object lines if (! empty($object->lines)) { - $disableedit=1; + //$disableedit=1; //$disablemove=1; $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice } From 6c0f8428432e281186bd03df4d56f5fa912fa2d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jun 2016 17:53:59 +0200 Subject: [PATCH 053/144] Missing translation --- htdocs/langs/en_US/bills.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 01e57a756b9..af2f6174315 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -323,6 +323,7 @@ NextDateToExecution=Date for next invoice generation DateLastGeneration=Date of latest generation MaxPeriodNumber=Max nb of invoice generation NbOfGenerationDone=Nb of invoice generation already done +MaxGenerationReached=Maximum nb of generations reached InvoiceAutoValidate=Validate invoices automatically GeneratedFromRecurringInvoice=Generated from template recurring invoice %s DateIsNotEnough=Date not reached yet From 4708f0114c72b85a0ec5262bf572b20946e78961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 10:05:05 +0200 Subject: [PATCH 054/144] Clean code --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8dc599441e2..c8bae6140c1 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -694,17 +694,17 @@ function setforpredef() { jQuery("#prod_entry_mode_free").prop('checked',false); jQuery("#prod_entry_mode_predef").prop('checked',true); jQuery("#price_ht").hide(); - jQuery("#title_up_ht").hide(); jQuery("#price_ttc").hide(); // May no exists jQuery("#tva_tx").hide(); jQuery("#buying_price").show(); + //jQuery("#fournprice_predef").show(); // management somewhere else jQuery("#title_vat").hide(); + jQuery("#title_up_ht").hide(); jQuery("#title_up_ttc").hide(); jQuery("#np_marginRate").hide(); // May no exists jQuery("#np_markRate").hide(); // May no exists jQuery(".np_marginRate").hide(); // May no exists jQuery(".np_markRate").hide(); // May no exists - jQuery(".np_markRate").hide(); // May no exists jQuery("#units, #title_units").hide(); } From dfc4f3e7fe8bd3b503402d6fc71e10de329c65d7 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 29 Jun 2016 11:06:02 +0200 Subject: [PATCH 055/144] on going accountacy working --- htdocs/accountancy/bookkeeping/card.php | 122 +++-- htdocs/accountancy/bookkeeping/list.php | 25 +- .../accountancy/class/bookkeeping.class.php | 432 ++++++++++-------- .../class/html.formventilation.class.php | 72 ++- .../accountancy/journal/purchasesjournal.php | 23 +- htdocs/accountancy/journal/sellsjournal.php | 33 +- htdocs/langs/en_US/accountancy.lang | 6 + 7 files changed, 405 insertions(+), 308 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7293797ecc6..ba3c37f1997 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/card.php - * \ingroup Advanced accountancy - * \brief Page to show book-entry + * \file htdocs/accountancy/bookkeeping/card.php + * \ingroup Advanced accountancy + * \brief Page to show book-entry */ require '../../main.inc.php'; @@ -62,17 +62,17 @@ if (! empty($update)) { } if ($action == "confirm_update") { - + $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $result = $book->fetch($id); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -82,7 +82,7 @@ if ($action == "confirm_update") { $book->label_compte = $label_compte; $book->debit = $debit; $book->credit = $credit; - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; @@ -91,7 +91,7 @@ if ($action == "confirm_update") { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->update($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -101,19 +101,19 @@ if ($action == "confirm_update") { } } } -} +} else if ($action == "add") { $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; @@ -126,17 +126,17 @@ else if ($action == "add") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = GETPOST('fk_doc'); $book->fk_docdet = GETPOST('fk_docdet'); - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } - + if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -145,15 +145,15 @@ else if ($action == "add") { $action = ''; } } -} +} else if ($action == "confirm_delete") { $book = new BookKeeping($db); - + $result = $book->fetch($id); - + $piece_num = $book->piece_num; - + if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { @@ -163,11 +163,11 @@ else if ($action == "confirm_delete") { } } $action = ''; -} +} else if ($action == "confirm_create") { $book = new BookKeeping($db); - + $book->label_compte = ''; $book->debit = 0; $book->credit = 0; @@ -178,9 +178,9 @@ else if ($action == "confirm_create") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = 0; $book->fk_docdet = 0; - + $book->montant = 0; - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -209,15 +209,15 @@ if ($action == 'delete') { if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); - + $code_journal_array = array ( $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL, $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL, $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL, $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL, - $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL + $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL ); - + $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0'; $resql = $db->query($sql); if (! $resql) { @@ -229,52 +229,52 @@ if ($action == 'create') { } } } - + $book = new BookKeeping($db); $next_num_mvt = $book->getNextNumMvt(); - + print '
'; print '' . "\n"; print '' . "\n"; - + dol_fiche_head(); - + print ''; print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; - + print '
' . $langs->trans("NumMvts") . '' . $next_num_mvt . '
' . $langs->trans("Docdate") . ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '
' . $langs->trans("Codejournal") . '' . $html->selectarray('code_journal', $code_journal_array) . '
' . $langs->trans("Docref") . '
' . $langs->trans("Doctype") . '
'; - + dol_fiche_end(); - + print '
'; print '     '; print '
'; - + print '
'; } else { $book = new BookKeeping($db); @@ -283,9 +283,9 @@ if ($action == 'create') { setEventMessages($book->error, $book->errors, 'errors'); } if (! empty($book->piece_num)) { - + print load_fiche_titre($langs->trans("UpdateMvts"), '' . $langs->trans('BackToList') . ''); - + print ''; print ''; print ''; @@ -309,14 +309,14 @@ if ($action == 'create') { print ''; print '
' . $langs->trans("NumMvts") . '
'; print '
'; - + $result = $book->fetch_all_per_mvt($piece_num); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - + print load_fiche_titre($langs->trans("ListeMvts")); - + print '
'; print '' . "\n"; print '' . "\n"; @@ -324,15 +324,15 @@ if ($action == 'create') { print '' . "\n"; print '' . "\n"; print '' . "\n"; - + print ""; if (count($book->linesmvt) > 0) { - + $total_debit = 0; $total_credit = 0; - + print ''; - + print_liste_field_titre($langs->trans("AccountAccountingShort")); print_liste_field_titre($langs->trans("Code_tiers")); print_liste_field_titre($langs->trans("Labelcompte")); @@ -341,18 +341,18 @@ if ($action == 'create') { print_liste_field_titre($langs->trans("Amount"), "", "", "", "", 'align="center"'); print_liste_field_titre($langs->trans("Sens"), "", "", "", "", 'align="center"'); print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"'); - + print "\n"; - + foreach ( $book->linesmvt as $line ) { $var = ! $var; - print ''; - + print ''; + $total_debit += $line->debit; $total_credit += $line->credit; - + if ($action == 'update' && $line->id == $id) { - + print ''; @@ -376,7 +376,7 @@ if ($action == 'create') { print ''; print ''; print ''; - + print ''; } print "\n"; } - + if ($total_debit != $total_credit) { setEventMessages(null, array ( - 'MvtNotCorrectlyBalanced', - $total_credit, - $total_debit + $langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit) ), 'errors'); } - + if ($action == "" || $action == 'add') { $var = ! $var; - print ''; + print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index cb5d7caf006..23148213aa0 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -202,14 +202,22 @@ if ($action == 'delbookkeeping') { if ($action == 'delbookkeepingyearconfirm') { $delyear = GETPOST('delyear', 'int'); + if ($delyear==-1) { + $delyear=0; + } + $deljournal = GETPOST('deljournal','alpha'); + if ($deljournal==-1) { + $deljournal=0; + } - if (! empty($delyear)) { - $result = $object->deleteByYear($delyear); + + if (! empty($delyear) || ! empty($deljournal)) { + $result = $object->deleteByYearAndJournal($delyear,$deljournal); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } Header("Location: list.php"); - exit(); + exit; } } if ($action == 'delmouvconfirm') { @@ -222,7 +230,7 @@ if ($action == 'delmouvconfirm') { setEventMessages($object->error, $object->errors, 'errors'); } Header("Location: list.php"); - exit(); + exit; } } if ($action == 'export_csv') { @@ -276,11 +284,13 @@ if ($action == 'delbookkeepingyear') { $form_question = array (); $delyear = GETPOST('delyear'); + $deljournal = GETPOST('deljournal'); if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + $journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array'); $form_question['delyear'] = array ( 'name' => 'delyear', @@ -289,6 +299,13 @@ if ($action == 'delbookkeepingyear') { 'values' => $year_array, 'default' => $delyear ); + $form_question['deljournal'] = array ( + 'name' => 'deljournal', + 'type' => 'select', + 'label' => $langs->trans('DelJournal'), + 'values' => $journal_array, + 'default' => $deljournal + ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); print $formconfirm; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6f4698413dc..79e66ab7cce 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -54,13 +54,13 @@ class BookKeeping extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'accounting_bookkeeping'; - + /** * * @var BookKeepingLine[] Lines */ public $lines = array (); - + /** * * @var int ID @@ -84,10 +84,10 @@ class BookKeeping extends CommonObject public $import_key; public $code_journal; public $piece_num; - + /** */ - + /** * Constructor * @@ -97,22 +97,24 @@ class BookKeeping extends CommonObject $this->db = $db; return 1; } - + /** * Create object into database * * @param User $user User that creates * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, Id of created object if OK */ public function create(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); - + + global $langs; + $error = 0; - + // Clean parameters - + if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -158,32 +160,32 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - + $this->db->begin(); - + $this->piece_num = 0; - + // first check if line not yet in bookkeeping $sql = "SELECT count(*) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - $sql .= " WHERE doc_type = '" . $this->doc_type . "'"; + $sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'"; $sql .= " AND fk_docdet = " . $this->fk_docdet; - $sql .= " AND numero_compte = '" . $this->numero_compte . "'"; - - dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); + $sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'"; + + dol_syslog(get_class($this) . ":: create ", LOG_DEBUG); $resql = $this->db->query($sql); - + if ($resql) { $row = $this->db->fetch_object($resql); if ($row->nb == 0) { - + // Determine piece_num $sqlnum = "SELECT piece_num"; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; $sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'"; $sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; - + dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -194,7 +196,7 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -202,18 +204,19 @@ class BookKeeping extends CommonObject $this->piece_num = $objnum->maxpiecenum; } } - dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG); if (empty($this->piece_num)) { $this->piece_num = 1; } - + + dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG); + $now = dol_now(); if (empty($this->date_create)) { $this->date_create = $now; } - + $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; - + $sql .= "doc_date"; $sql .= ", doc_type"; $sql .= ", doc_ref"; @@ -230,33 +233,33 @@ class BookKeeping extends CommonObject $sql .= ", import_key"; $sql .= ", code_journal"; $sql .= ", piece_num"; - + $sql .= ") VALUES ("; - - $sql .= "'" . $this->doc_date . "'"; - $sql .= ",'" . $this->doc_type . "'"; - $sql .= ",'" . $this->doc_ref . "'"; + + $sql .= "'" . $this->db->idate($this->doc_date) . "'"; + $sql .= ",'" . $this->db->escape($this->doc_type) . "'"; + $sql .= ",'" . $this->db->escape($this->doc_ref) . "'"; $sql .= "," . $this->fk_doc; $sql .= "," . $this->fk_docdet; - $sql .= ",'" . $this->code_tiers . "'"; - $sql .= ",'" . $this->numero_compte . "'"; + $sql .= ",'" . $this->db->escape($this->code_tiers) . "'"; + $sql .= ",'" . $this->db->escape($this->numero_compte) . "'"; $sql .= ",'" . $this->db->escape($this->label_compte) . "'"; $sql .= "," . $this->debit; $sql .= "," . $this->credit; $sql .= "," . $this->montant; - $sql .= ",'" . $this->sens . "'"; + $sql .= ",'" . $this->db->escape($this->sens) . "'"; $sql .= ",'" . $this->fk_user_author . "'"; $sql .= ",'" . $this->date_create . "'"; - $sql .= ",'" . $this->code_journal . "'"; + $sql .= ",'" . $this->db->escape($this->code_journal) . "'"; $sql .= "," . $this->piece_num; - + $sql .= ")"; - - dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); + + dol_syslog(get_class($this) . ":: create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - + if ($id > 0) { $this->id = $id; $result = 0; @@ -264,67 +267,67 @@ class BookKeeping extends CommonObject $result = - 2; $error ++; $this->errors[] = 'Error Create Error ' . $result . ' lecture ID'; - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR); } } else { $result = - 1; $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR); } } else { $result = - 3; $error ++; - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $this->errors[] = $langs->trans('BookeppingLineAlreayExists'); + dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR); } } else { $result = - 5; $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + dol_syslog(__METHOD__ . ' $result='.$result.' '. implode(',', $this->errors), LOG_ERR); } - + if (! $error) { - + if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_CREATE',$user); // if ($result < 0) $error++; // // End call triggers } } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return $result; } } - + /** * Create object into database * * @param User $user User that creates * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, Id of created object if OK */ public function createStd(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); - + $error = 0; - + // Clean parameters - + if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -370,13 +373,13 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - + // Check parameters // Put here code to add control on parameters values - + // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - + $sql .= 'doc_date,'; $sql .= 'doc_type,'; $sql .= 'doc_ref,'; @@ -393,9 +396,9 @@ class BookKeeping extends CommonObject $sql .= 'import_key,'; $sql .= 'code_journal,'; $sql .= 'piece_num'; - + $sql .= ') VALUES ('; - + $sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ','; $sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ','; $sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ','; @@ -412,58 +415,58 @@ class BookKeeping extends CommonObject $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; $sql .= ' ' . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num); - + $sql .= ')'; - + $this->db->begin(); - + $resql = $this->db->query($sql); if (! $resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - + if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - + if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_CREATE',$user); // if ($result < 0) $error++; // // End call triggers } } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return $this->id; } } - + /** * Load object in memory from the database * * @param int $id Id object * @param string $ref Ref - * + * * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null) { dol_syslog(__METHOD__, LOG_DEBUG); - + $sql = 'SELECT'; $sql .= ' t.rowid,'; - + $sql .= " t.doc_date,"; $sql .= " t.doc_type,"; $sql .= " t.doc_ref,"; @@ -480,22 +483,22 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.piece_num"; - + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; if (null !== $ref) { $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; } else { $sql .= ' WHERE t.rowid = ' . $id; } - + $resql = $this->db->query($sql); if ($resql) { $numrows = $this->db->num_rows($resql); if ($numrows) { $obj = $this->db->fetch_object($resql); - + $this->id = $obj->rowid; - + $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_type = $obj->doc_type; $this->doc_ref = $obj->doc_ref; @@ -514,7 +517,7 @@ class BookKeeping extends CommonObject $this->piece_num = $obj->piece_num; } $this->db->free($resql); - + if ($numrows) { return 1; } else { @@ -523,11 +526,11 @@ class BookKeeping extends CommonObject } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - + return - 1; } } - + /** * Load object in memory from the database * @@ -537,15 +540,15 @@ class BookKeeping extends CommonObject * @param int $offset offset limit * @param array $filter filter array * @param string $filtermode filter mode (AND or OR) - * + * * @return int <0 if KO, >0 if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); - + $sql = 'SELECT'; $sql .= ' t.rowid,'; - + $sql .= " t.doc_date,"; $sql .= " t.doc_type,"; $sql .= " t.doc_ref,"; @@ -562,9 +565,9 @@ class BookKeeping extends CommonObject $sql .= " t.import_key,"; $sql .= " t.code_journal,"; $sql .= " t.piece_num"; - + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - + // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -584,11 +587,11 @@ class BookKeeping extends CommonObject } } } - + if (count($sqlwhere) > 0) { $sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); } - + if (! empty($sortfield)) { $sql .= $this->db->order($sortfield, $sortorder); } @@ -596,16 +599,16 @@ class BookKeeping extends CommonObject $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } $this->lines = array (); - + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - + while ( $obj = $this->db->fetch_object($resql) ) { $line = new BookKeepingLine(); - + $line->id = $obj->rowid; - + $line->doc_date = $this->db->jdate($obj->doc_date); $line->doc_type = $obj->doc_type; $line->doc_ref = $obj->doc_ref; @@ -622,20 +625,20 @@ class BookKeeping extends CommonObject $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; - + $this->lines[] = $line; } $this->db->free($resql); - + return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - + return - 1; } } - + /** * Load object in memory from the database * @@ -650,15 +653,15 @@ class BookKeeping extends CommonObject */ public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); - + $sql = 'SELECT'; $sql .= " t.numero_compte,"; $sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.credit) as credit"; - - + + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - + // Manage filter $sqlwhere = array (); if (count($filter) > 0) { @@ -678,13 +681,13 @@ class BookKeeping extends CommonObject } } } - + if (count($sqlwhere) > 0) { $sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); } - + $sql .= ' GROUP BY t.numero_compte'; - + if (! empty($sortfield)) { $sql .= $this->db->order($sortfield, $sortorder); } @@ -692,45 +695,45 @@ class BookKeeping extends CommonObject $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } $this->lines = array (); - + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - + while ( $obj = $this->db->fetch_object($resql) ) { $line = new BookKeepingLine(); - + $line->numero_compte = $obj->numero_compte; $line->debit = $obj->debit; $line->credit = $obj->credit; $this->lines[] = $line; } $this->db->free($resql); - + return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - + return - 1; } } - + /** * Update object into database * * @param User $user User that modifies * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, >0 if OK */ public function update(User $user, $notrigger = false) { $error = 0; - + dol_syslog(__METHOD__, LOG_DEBUG); - + // Clean parameters - + if (isset($this->doc_type)) { $this->doc_type = trim($this->doc_type); } @@ -776,13 +779,13 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - + // Check parameters // Put here code to add a control on parameters values - + // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - + $sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ','; $sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ','; $sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ','; @@ -799,71 +802,71 @@ class BookKeeping extends CommonObject $sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ','; $sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ','; $sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null"); - + $sql .= ' WHERE rowid=' . $this->id; - + $this->db->begin(); - + $resql = $this->db->query($sql); if (! $resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - + if (! $error && ! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // // End call triggers } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return 1; } } - + /** * Delete object in database * * @param User $user User that deletes * @param bool $notrigger false=launch triggers after, true=disable triggers - * + * * @return int <0 if KO, >0 if OK */ public function delete(User $user, $notrigger = false) { dol_syslog(__METHOD__, LOG_DEBUG); - + $error = 0; - + $this->db->begin(); - + if (! $error) { if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - + // // Call triggers // $result=$this->call_trigger('MYOBJECT_DELETE',$user); // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // // End call triggers } } - + if (! $error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; - + $resql = $this->db->query($sql); if (! $resql) { $error ++; @@ -871,19 +874,19 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } } - + // Commit or rollback if ($error) { $this->db->rollback(); - + return - 1 * $error; } else { $this->db->commit(); - + return 1; } } - + /** * Delete bookkepping by importkey * @@ -892,14 +895,14 @@ class BookKeeping extends CommonObject */ function deleteByImportkey($importkey) { $this->db->begin(); - + // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE import_key = '" . $importkey . "'"; - + $resql = $this->db->query($sql); - + if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); foreach ( $this->errors as $errmsg ) { @@ -909,11 +912,11 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } - + $this->db->commit(); return 1; } - + /** * Delete bookkepping by year * @@ -922,14 +925,14 @@ class BookKeeping extends CommonObject */ function deleteByYear($delyear) { $this->db->begin(); - + // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE YEAR(doc_date) = " . $delyear; - + $resql = $this->db->query($sql); - + if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); foreach ( $this->errors as $errmsg ) { @@ -939,11 +942,54 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } - + $this->db->commit(); return 1; } - + + /** + * Delete bookkepping by year + * + * @param string $delyear year to delete + * @param string $deljournal journal to delete + * @return int Result + */ + function deleteByYearAndJournal($delyear,$deljournal) { + $this->db->begin(); + + $sqlwhere=array(); + + // first check if line not yet in bookkeeping + $sql = "DELETE"; + $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; + if (!empty($delyear)) { + $sqlwhere[] .= " YEAR(doc_date) = " . $delyear; + } + if (!empty($deljournal)) { + $sqlwhere[] .= " code_journal = '" . $this->db->escape($deljournal)."'"; + } + + if (count($sqlwhere)>0) { + $sql.=" WHERE ".implode(' AND ', $sqlwhere); + + $resql = $this->db->query($sql); + + if (! $resql) { + $this->errors[] = "Error " . $this->db->lasterror(); + foreach ( $this->errors as $errmsg ) { + dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + $this->db->rollback(); + return - 1; + } + + $this->db->commit(); + + } + return 1; + } + /** * Delete bookkepping by piece number * @@ -952,14 +998,14 @@ class BookKeeping extends CommonObject */ function deleteMvtNum($piecenum) { $this->db->begin(); - + // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - + $resql = $this->db->query($sql); - + if (! $resql) { $this->errors[] = "Error " . $this->db->lasterror(); foreach ( $this->errors as $errmsg ) { @@ -969,57 +1015,57 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } - + $this->db->commit(); return 1; } - + /** * Load an object from its id and create a new one in database * * @param int $fromid Id of object to clone - * + * * @return int New id of clone */ public function createFromClone($fromid) { dol_syslog(__METHOD__, LOG_DEBUG); - + global $user; $error = 0; $object = new Accountingbookkeeping($this->db); - + $this->db->begin(); - + // Load source object $object->fetch($fromid); // Reset object $object->id = 0; - + // Clear fields // ... - + // Create clone $result = $object->create($user); - + // Other options if ($result < 0) { $error ++; $this->errors = $object->errors; dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - + // End if (! $error) { $this->db->commit(); - + return $object->id; } else { $this->db->rollback(); - + return - 1; } } - + /** * Initialise object with example values * Id must be 0 if object instance is a specimen @@ -1028,7 +1074,7 @@ class BookKeeping extends CommonObject */ public function initAsSpecimen() { $this->id = 0; - + $this->doc_date = ''; $this->doc_type = ''; $this->doc_ref = ''; @@ -1046,7 +1092,7 @@ class BookKeeping extends CommonObject $this->code_journal = ''; $this->piece_num = ''; } - + /** * Load an accounting document into memory from database * @@ -1057,12 +1103,12 @@ class BookKeeping extends CommonObject $sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - + dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - + $this->piece_num = $obj->piece_num; $this->code_journal = $obj->code_journal; $this->doc_date = $this->db->jdate($obj->doc_date); @@ -1073,10 +1119,10 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); return - 1; } - + return 1; } - + /** * Return next number movement * @@ -1084,13 +1130,13 @@ class BookKeeping extends CommonObject */ public function getNextNumMvt() { $sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); - + if ($result) { $obj = $this->db->fetch_object($result); - + return $obj->max; } else { $this->error = "Error " . $this->db->lasterror(); @@ -1098,7 +1144,7 @@ class BookKeeping extends CommonObject return - 1; } } - + /** * Load all informations of accountancy document * @@ -1112,17 +1158,17 @@ class BookKeeping extends CommonObject $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - + dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - + while ( $obj = $this->db->fetch_object($result) ) { - + $line = new BookKeepingLine(); - + $line->id = $obj->rowid; - + $line->doc_date = $this->db->jdate($obj->doc_date); $line->doc_type = $obj->doc_type; $line->doc_ref = $obj->doc_ref; @@ -1137,7 +1183,7 @@ class BookKeeping extends CommonObject $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; - + $this->linesmvt[] = $line; } } else { @@ -1145,10 +1191,10 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); return - 1; } - + return 1; } - + /** * Export bookkeping * @@ -1161,20 +1207,20 @@ class BookKeeping extends CommonObject $sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); - + $resql = $this->db->query($sql); - + if ($resql) { $this->linesexport = array (); - + $num = $this->db->num_rows($resql); while ( $obj = $this->db->fetch_object($resql) ) { $line = new BookKeepingLine(); - + $line->id = $obj->rowid; - + $line->doc_date = $this->db->jdate($obj->doc_date); $line->doc_type = $obj->doc_type; $line->doc_ref = $obj->doc_ref; @@ -1189,11 +1235,11 @@ class BookKeeping extends CommonObject $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; - + $this->linesexport[] = $line; } $this->db->free($resql); - + return $num; } else { $this->error = "Error " . $this->db->lasterror(); @@ -1201,15 +1247,15 @@ class BookKeeping extends CommonObject return - 1; } } - + /** * Description of accounting account * * @param string $account Accounting account - * @return string + * @return string */ function get_compte_desc($account = null) - { + { global $conf; $pcgver = $conf->global->CHARTOFACCOUNTS; @@ -1226,14 +1272,14 @@ class BookKeeping extends CommonObject if ($resql) { $obj = ''; if ($this->db->num_rows($resql)) { - $obj = $this->db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); } - - if(empty($obj->category)){ + + if(empty($obj->category)){ return $obj->label; }else{ return $obj->label.' ('.$obj->category.')'; - + } } else { $this->error = "Error " . $this->db->lasterror(); @@ -1242,7 +1288,7 @@ class BookKeeping extends CommonObject return -1; } } - + } /** diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index e3ae592a47f..9294cf7f6a8 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -58,7 +58,7 @@ class FormVentilation extends Form return Form::selectarray($htmlname, $options, $selectedkey); } - + /** * Return list of accounts with label by chart of accounts * @@ -69,23 +69,23 @@ class FormVentilation extends Form * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) * @param int $select_out set value returned by select 0=rowid (default), 1=account_number * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number - * + * * @return string String with HTML select */ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { global $conf; - + require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - + $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND aa.active = 1"; $sql .= " ORDER BY aa.account_number"; - + dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); $resql = $this->db->query($sql); @@ -127,7 +127,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of accounts with label by class of accounts * @@ -135,18 +135,18 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { global $conf; - + $sql = "SELECT DISTINCT pcg_type "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_type"; - + dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG); $resql = $this->db->query($sql); @@ -168,7 +168,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of accounts with label by sub_class of accounts * @@ -176,18 +176,18 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) { global $conf; - + $sql = "SELECT DISTINCT pcg_subtype "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_subtype"; - + dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG); $resql = $this->db->query($sql); @@ -209,7 +209,7 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } - + /** * Return list of auxilary thirdparty accounts * @@ -217,7 +217,7 @@ class FormVentilation extends Form * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * + * * @return string String with HTML select */ function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { @@ -246,7 +246,7 @@ class FormVentilation extends Form // Auxiliary supplier account $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " ORDER BY code_compta"; + $sql .= " ORDER BY code_compta_fournisseur"; dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -268,7 +268,7 @@ class FormVentilation extends Form return $out; } - + /** * Return HTML combo list of years existing into book keepping * @@ -284,7 +284,7 @@ class FormVentilation extends Form $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " ORDER BY doc_date"; + $sql .= " ORDER BY date_format(doc_date,'%Y')"; dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -304,4 +304,40 @@ class FormVentilation extends Form return $out_array; } } + + /** + * Return HTML combo list of years existing into book keepping + * + * @param string $selected Preselected value + * @param string $htmlname Name of HTML select object + * @param int $useempty Affiche valeur vide dans liste + * @param string $output_format (html/opton (for option html only)/array (to return options arrays + * @return string/array + */ + function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html') + { + $out_array = array(); + + $sql = "SELECT DISTINCT code_journal"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; + $sql .= " ORDER BY code_journal"; + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); + return -1; + } + while ($obj = $this->db->fetch_object($resql)) { + $out_array[$obj->code_journal] = $obj->code_journal; + } + $this->db->free($resql); + + if ($output_format == 'html') { + return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"'); + } else { + return $out_array; + } + } } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 5ca1197b3e2..f66293b6185 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -138,7 +138,7 @@ if ($result) { //Define array for display vat tx $def_tva[$obj->rowid]=price($obj->tva_tx); - $tabfac[$obj->rowid]["date"] = $obj->df; + $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')'; $tabfac[$obj->rowid]["refsologest"] = $obj->ref; $tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier; @@ -193,7 +193,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur']; - $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers"); + $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -225,7 +225,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = ''; - $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label); + $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label; $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -256,7 +256,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = ''; - $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]; + $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]; $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -297,7 +297,7 @@ if ($action == 'export_csv') { $sep = ";"; foreach ( $tabfac as $key => $val ) { - $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); + $date = dol_print_date($val["date"], '%d%m%Y'); // Product / Service foreach ( $tabht[$key] as $k => $mt ) { @@ -340,7 +340,7 @@ if ($action == 'export_csv') { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode($companystatic->name) . $sep; + print $companystatic->name . $sep; print $val["ref"]; print "\n"; } @@ -356,7 +356,7 @@ if ($action == 'export_csv') { $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); - $date = dol_print_date($db->jdate($val["date"]), 'day'); + $date = dol_print_date($val["date"], 'day'); $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; @@ -370,7 +370,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; // print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; @@ -384,7 +384,7 @@ if ($action == 'export_csv') { print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; // print '"' . $langs->trans("VAT") . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print "\n"; @@ -396,8 +396,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - // print '"' . utf8_decode($companystatic->name) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; } @@ -479,7 +478,7 @@ if ($action == 'export_csv') { $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); - $date = dol_print_date($db->jdate($val["date"]), 'day'); + $date = dol_print_date($val["date"], 'day'); // Product / Service foreach ( $tabht[$key] as $k => $mt ) { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 5da210ca09a..1f21788bc30 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -161,7 +161,7 @@ if ($result) { } // Invoice lines - $tabfac[$obj->rowid]["date"] = $obj->df; + $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); $tabfac[$obj->rowid]["ref"] = $obj->facnumber; $tabfac[$obj->rowid]["type"] = $obj->type; $tabfac[$obj->rowid]["description"] = $obj->label_compte; @@ -220,7 +220,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; // $bookkeeping->label_compte = $tabcompany[$key]['name']; - $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"); + $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0) ? $mt : 0; @@ -250,7 +250,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label); + $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -280,7 +280,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key]; + $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key]; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -324,7 +324,7 @@ if ($action == 'export_csv') { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; - $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); + $date = dol_print_date($val["date"], '%d%m%Y'); foreach ( $tabttc[$key] as $k => $mt ) { print $date . $sep; @@ -333,8 +333,7 @@ if ($action == 'export_csv') { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; - // print utf8_decode($companystatic->name) . $sep; + print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; print $val["ref"]; print "\n"; } @@ -349,8 +348,7 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount_static->label)) . $sep; - // print dol_trunc($accountingaccount_static->label, 32) . $sep; + print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep; print $val["ref"]; print "\n"; } @@ -365,7 +363,7 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep; + print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep; // print $langs->trans("VAT") . $sep; print $val["ref"]; print "\n"; @@ -382,14 +380,13 @@ if ($action == 'export_csv') { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; - $date = dol_print_date($db->jdate($val["date"]), 'day'); + $date = dol_print_date($val["date"], 'day'); foreach ( $tabttc[$key] as $k => $mt ) { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; - // print '"' . utf8_decode($companystatic->name) . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print "\n"; @@ -404,8 +401,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; - // print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print "\n"; @@ -418,8 +414,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep; - // print '"' . $langs->trans("VAT") . '"' . $sep; + print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print "\n"; @@ -497,7 +492,7 @@ if ($action == 'export_csv') { $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; - $date = dol_print_date($db->jdate($val["date"]), 'day'); + $date = dol_print_date($val["date"], 'day'); // Third party foreach ( $tabttc[$key] as $k => $mt ) { @@ -527,7 +522,7 @@ if ($action == 'export_csv') { print ""; print ""; // print ""; - print ""; + print ""; print ""; print ""; print ""; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 18742ba0ed7..433d5a0178d 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -84,6 +84,11 @@ AccountingCategory=Accounting category NotMatch=Not Set +DeleteMvt=Delete general ledger lines +DelYear=Year to delete +DelJournal=Journal to delete +ConfirmDeleteMvt=This will delete all line of of the general ledger for year and/or from a specifics journal + DelBookKeeping=Delete the records of the general ledger DescSellsJournal=Sales journal @@ -160,3 +165,4 @@ Formula=Formula ## Error ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country ExportNotSupported=The export format setuped is not supported into this page +BookeppingLineAlreayExists=Lines already existing into bookeeping From 8bcd2e581f7cc9f72c170afeb0a3d59198ca3eac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 11:20:48 +0200 Subject: [PATCH 056/144] Fix of bugs reported by scrutinizer --- htdocs/accountancy/journal/purchasesjournal.php | 7 +++---- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/adherents/class/adherent.class.php | 3 ++- htdocs/adherents/class/cotisation.class.php | 2 +- htdocs/categories/categorie.php | 3 ++- htdocs/compta/facture/class/facture-rec.class.php | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 5ca1197b3e2..2fbf056b0b9 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -166,14 +166,13 @@ if ($action == 'writebookkeeping') { $now = dol_now(); $error = 0; - foreach ( $tabfac as $key => $val ) { - + foreach ($tabfac as $key => $val) + { $companystatic = new Societe($db); $invoicestatic = new FactureFournisseur($db); $invoicestatic->id = $key; - $invoicestatic->ref = $val["ref"]; - $invoicestatic->ref = $val["refsologest"]; + $invoicestatic->ref = (string) $val["refsologest"]; $invoicestatic->refsupplier = $val["refsuppliersologest"]; $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 5da210ca09a..c462f036a9f 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -207,7 +207,7 @@ if ($action == 'writebookkeeping') { $companystatic->client = $tabcompany[$key]['code_client']; $invoicestatic->id = $key; - $invoicestatic->ref = $val["ref"]; + $invoicestatic->ref = (string) $val["ref"]; foreach ( $tabttc[$key] as $k => $mt ) { $bookkeeping = new BookKeeping($db); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 33e4d0bec0d..e12c49732dd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -316,7 +316,7 @@ class Adherent extends CommonObject if ($id > 0) { $this->id=$id; - $this->ref=$id; + $this->ref=(string) $id; // Update minor fields $result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user @@ -1578,6 +1578,7 @@ class Adherent extends CommonObject $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + $link=''; $linkend=''; if ($option == 'card') { $link = 'trans("SuppliersCategoriesShort"); if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort"); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 357835fbb77..1d75be61f6c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -509,7 +509,7 @@ class FactureRec extends CommonInvoice $facid=$this->id; - dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); + dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Check parameters @@ -631,7 +631,7 @@ class FactureRec extends CommonInvoice $facid=$this->id; - dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); + dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Check parameters From 1e9cee1b07bc97a52a1b21edf77b990b314baf32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 11:48:28 +0200 Subject: [PATCH 057/144] Fix bug reported by scrutinizer --- htdocs/comm/action/class/ical.class.php | 2 +- scripts/product/migrate_picture_path.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 54f97fa2117..8254a5de1ba 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -208,7 +208,7 @@ class ICal //print 'type='.$type.' key='.$key.' value='.$value.'
'."\n"; - if ($key == false) + if (empty($key)) { $key = $this->last_key; switch ($type) diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 9d3cba8452f..f8624ebc040 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -1,6 +1,6 @@ #!/usr/bin/env php +/* Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2015 Jean Heimburger * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,6 @@ * \file scripts/product/migrate_picture_path.php * \ingroup scripts * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ - * */ $sapi_type = php_sapi_name(); @@ -119,7 +118,7 @@ function migrate_product_photospath($product) $handle=opendir($origin_osencoded); if (is_resource($handle)) { - while (($file = readdir($handle)) != false) + while (($file = readdir($handle)) !== false) { if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file)) { @@ -127,7 +126,7 @@ function migrate_product_photospath($product) if (is_resource($thumbs)) { dol_mkdir($destin.'/'.$file); - while (($thumb = readdir($thumbs)) != false) + while (($thumb = readdir($thumbs)) !== false) { dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); } From dcfc3856454888c2cba0b86f7e5dac00aa538ae1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 12:26:01 +0200 Subject: [PATCH 058/144] Fix to avoid blocking error in auto upgrade process --- htdocs/core/class/extrafields.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 283d189377c..32f0790fd89 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -633,7 +633,8 @@ class ExtraFields } else { - print dol_print_error($this->db); + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR); } return $array_name_label; From 933ec6c11862059543e45dcc7dfef4286da18040 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 13:14:53 +0200 Subject: [PATCH 059/144] FIX detection of HTML content when only p tag is present. --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 495d7ce1c3c..136e31bd23a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4548,9 +4548,9 @@ function dol_textishtml($msg,$option=0) if (preg_match('//i',$msg)) return true; - elseif (preg_match('/<(br|div|font|li|span|strong|table)>/i',$msg)) return true; - elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; - elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; + elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i',$msg)) return true; + elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; + elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; elseif (preg_match('/]*src[^<>]*>/i',$msg)) return true; // must accept elseif (preg_match('/]*href[^<>]*>/i',$msg)) return true; // must accept
elseif (preg_match('//i',$msg)) return true; From ab444af8c2742f267127e59b3cabdea9743a5df8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 13:38:19 +0200 Subject: [PATCH 060/144] Fix bad css --- htdocs/admin/menus/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index cba8d45c8f3..c8b7b469bd2 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -361,7 +361,7 @@ if ($conf->use_javascript_ajax) if (count($remainingdata)) { - print '
'; print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); print '' . price($line->credit) . '' . price($line->montant) . '' . $line->sens . ''; print ''; print img_edit(); @@ -384,23 +384,21 @@ if ($action == 'create') { print ''; print img_delete(); print ''; - + print '
'; print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print '" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $accountingaccount->label . "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount->label)) . "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
'; + print '
'; print ''; print ''; From 5f5328c3d87c41f8834e137b591d76cc014defec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 14:09:18 +0200 Subject: [PATCH 061/144] FIX Link in menu when using left menu editor was wrong. FIX Updating an entry with menu editor did not save fk_leftmenu. --- htdocs/admin/menus/edit.php | 41 +++++++++++++++++++--- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 24 +++++++++---- 3 files changed, 54 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9209542a9c0..b299a1f18fe 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -62,6 +62,23 @@ if ($action == 'update') { if (! $_POST['cancel']) { + $leftmenu=''; $mainmenu=''; + if (! empty($_POST['menuIdParent']) && ! is_numeric($_POST['menuIdParent'])) + { + $tmp=explode('&',$_POST['menuIdParent']); + foreach($tmp as $s) + { + if (preg_match('/fk_mainmenu=/',$s)) + { + $mainmenu=preg_replace('/fk_mainmenu=/','',$s); + } + if (preg_match('/fk_leftmenu=/',$s)) + { + $leftmenu=preg_replace('/fk_leftmenu=/','',$s); + } + } + } + $menu = new Menubase($db); $result=$menu->fetch($_POST['menuId']); if ($result > 0) @@ -75,7 +92,18 @@ if ($action == 'update') $menu->perms=$_POST['perms']; $menu->target=$_POST['target']; $menu->user=$_POST['user']; - $menu->fk_menu=$_POST['fk_menu']; + if (is_numeric($_POST['menuIdParent'])) + { + $menu->fk_menu=$_POST['menuIdParent']; + } + else + { + if ($_POST['type'] == 'top') $menu->fk_menu=0; + else $menu->fk_menu=-1; + $menu->fk_mainmenu=$mainmenu; + $menu->fk_leftmenu=$leftmenu; + } + $result=$menu->update($user); if ($result > 0) { @@ -342,7 +370,7 @@ if ($action == 'create') } else { - print ''; + print ''; } print ''; // MenuId Parent - print ''; + print ''; $valtouse=$menu->fk_menu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; - print ''; - print ''; + print ''; + print ''; // Niveau //print ''; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 05b3bbf054d..2df0bf6fdef 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -78,7 +78,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $tmp=explode('?',$newTabMenu[$i]['url'],2); + $tmp=explode('?',$newTabMenu[$i]['url'],2); $url = $shorturl = $tmp[0]; $param = (isset($tmp[1])?$tmp[1]:''); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e812d9919fd..9c9880c8ed1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1453,15 +1453,25 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - // For external modules - $tmp=explode('?',$menu_array[$i]['url'],2); - $url = $tmp[0]; - $param = (isset($tmp[1])?$tmp[1]:''); - $url = dol_buildpath($url,1).($param?'?'.$param:''); - + $url = $shorturl = $menu_array[$i]['url']; + + if (! preg_match("/^(http:\/\/|https:\/\/)/i",$menu_array[$i]['url'])) + { + $tmp=explode('?',$menu_array[$i]['url'],2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1])?$tmp[1]:''); + + if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad + $url = dol_buildpath($url,1).($param?'?'.$param:''); + $shorturl = $shorturl.($param?'?'.$param:''); + } + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); $url=preg_replace('/__USERID__/',$user->id,$url); - + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); + print ''."\n"; // Menu niveau 0 From 76a113257e965d154da458444ead0a4c5c3490ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jun 2016 16:16:56 +0200 Subject: [PATCH 062/144] Update index.php --- htdocs/comm/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 93f9b243624..eef29d2edc3 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -341,7 +341,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1,'customer',16); + print $companystatic->getNomUrl(1,'supplier',16); print ''; print ''; $i++; @@ -647,7 +647,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''."\n"; @@ -746,7 +746,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''."\n"; From a55a166df3e3069edaa0bf4afc3969ba185a8a14 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Wed, 29 Jun 2016 16:30:47 +0200 Subject: [PATCH 063/144] FIX old method add have to return create method result for backward compatibility --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6b77e2414da..e759e93a635 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -406,7 +406,7 @@ class ActionComm extends CommonObject */ public function add(User $user, $notrigger = 0) { - $this->create($user, $notrigger); + return $this->create($user, $notrigger); } /** From ea3e851ec05b101817ff0c9d1a11c51bbe491864 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 29 Jun 2016 16:54:37 +0200 Subject: [PATCH 064/144] Fix stuff in accoutancy --- htdocs/accountancy/admin/categories.php | 129 +++---- .../class/accountancycategory.class.php | 342 +++++++++--------- htdocs/accountancy/report/result.php | 73 ++-- htdocs/core/modules/modAccounting.class.php | 10 +- 4 files changed, 290 insertions(+), 264 deletions(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index b1836836e84..e1a0e3fe052 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/accountancy/admin/categories.php - * \ingroup Advanced accountancy - * \brief Page to assign mass categories to accounts + * \file htdocs/accountancy/admin/categories.php + * \ingroup Advanced accountancy + * \brief Page to assign mass categories to accounts */ require '../../main.inc.php'; @@ -36,11 +36,11 @@ $langs->load("accountancy"); $mesg = ''; $action = GETPOST('action'); $cat_id = GETPOST('account_category'); -$selectcpt = GETPOST('cpt_bk'); +$selectcpt = GETPOST('cpt_bk', 'array'); $cpt_id = GETPOST('cptid'); -if($cat_id == 0){ - $cat_id = null; +if ($cat_id == 0) { + $cat_id = null; } $id = GETPOST('id', 'int'); @@ -54,31 +54,30 @@ if (! $user->admin) $AccCat = new AccountancyCategory($db); // si ajout de comptes -if(!empty($selectcpt)){ - $cpts = array(); - $i = 0; - foreach ($selectcpt as $selectedOption){ - $cpts[$i] = "'".$selectedOption."'"; - $i++; +if (! empty($selectcpt)) { + $cpts = array (); + foreach ( $selectcpt as $selectedOption ) { + if (! array_key_exists($selectedOption, $cpts)) + $cpts[$selectedOption] = "'" . $selectedOption . "'"; } - - if($AccCat->updateAccAcc($cat_id, $cpts)){ + + $return= $AccCat->updateAccAcc($cat_id, $cpts); + + if ($return<0) { + setEventMessages($langs->trans('errors'), $AccCat->errors, 'errors'); + } else { setEventMessages($langs->trans('Saved'), null, 'mesgs'); - }else{ - setEventMessages($langs->trans('errors'), null, 'errors'); } - - } if ($action == 'delete') { - if($cpt_id){ - if($AccCat->deleteCptCat($cpt_id)){ + if ($cpt_id) { + if ($AccCat->deleteCptCat($cpt_id)) { setEventMessages($langs->trans('Deleted'), null, 'mesgs'); - }else{ + } else { setEventMessages($langs->trans('errors'), null, 'errors'); } } -} +} /* * View @@ -88,65 +87,69 @@ llxheader('', $langs->trans('AccountAccounting')); $formaccounting = new FormAccounting($db); $form = new Form($db); - print load_fiche_titre($langs->trans('Categories')); +print load_fiche_titre($langs->trans('Categories')); - print '' . "\n"; - print ''; - print ''; +print '' . "\n"; +print ''; +print ''; - dol_fiche_head(); +dol_fiche_head(); - print '
'.$langs->trans("NotTopTreeMenuPersonalized").''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; @@ -425,12 +453,15 @@ elseif ($action == 'edit') print '
'.$langs->trans('Type').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').'
'.$langs->trans('MenuIdParent').'
'.$langs->trans('MenuIdParent'); + print ''.$langs->trans('DetailMenuIdParent').'
'.$langs->trans('DetailMenuIdParent'); + print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; + print '
'.$langs->trans('Level').''.$menu->level.''.$langs->trans('DetailLevel').'
'.price($obj->total_ttc).'
'; print dol_print_date($db->jdate($obj->dp),'day').''; print dol_print_date($db->jdate($obj->dp),'day').'
'; - // Category - print ''; - print ''; +print '
' . $langs->trans("AccountingCategory") . ''; - $formaccounting->select_accounting_category($cat_id, 'account_category', 1); - print ''; - print '
'; +// Category +print ''; +print ''; - - if(!empty($cat_id)){ - $obj = $AccCat->getCptBK($cat_id); - print ''; - print ''; +if (! empty($cat_id)) { + $return = $AccCat->getCptBK($cat_id); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); } - - print '
' . $langs->trans("AccountingCategory") . ''; +$formaccounting->select_accounting_category($cat_id, 'account_category', 1); +print ''; +print '
' . $langs->trans("AddCompteFromBK") . ''; - if(!empty($obj)){ - print ' - '; - } - print '
'; + print '' . $langs->trans("AddCompteFromBK") . ''; + print ''; + if (is_array($AccCat->lines_cptbk) && count($AccCat->lines_cptbk) > 0) { + print ' - '; + } + print ''; +} - dol_fiche_end(); +print ''; - print ''; +dol_fiche_end(); + +print ''; if ($action == 'display' || $action == 'delete') { print ''; - print ''; + print ''; - if(!empty($cat_id)){ - $obj = $AccCat->display($cat_id); - $j=1; - if(!empty($obj)){ - foreach ( $obj as $cpt ) { + if (! empty($cat_id)) { + $return = $AccCat->display($cat_id); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + } + $j = 1; + if (is_array($AccCat->lines_display) && count($AccCat->lines_display) > 0) { + foreach ( $AccCat->lines_display as $cpt ) { $var = ! $var; - print ''; + print ''; print ''; print ''; - print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j); - print ''; + print $form->formconfirm($_SERVER["PHP_SELF"] . "?account_category=$cat_id&cptid=" . $cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete" . $j); + print ''; print "\n"; - $j++; + $j ++; } - } + } } print "
'.$langs->trans("Numerocompte").''.$langs->trans("Description").'Action
' . $langs->trans("Numerocompte") . '' . $langs->trans("Description") . 'Action
' . length_accountg($cpt->account_number) . '' . $cpt->label . '
"; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index ef880aa8113..43b9816c5ed 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/accountancy/class/accountancycategory.class.php - * \ingroup Advanced accountancy - * \brief File of class to manage categories of an accounting category_type + * \file htdocs/accountancy/class/accountancycategory.class.php + * \ingroup Advanced accountancy + * \brief File of class to manage categories of an accounting category_type */ // Class @@ -32,18 +32,20 @@ class AccountancyCategory { private $db; public $error; - public $errors = array(); - //public $element='accounting_category'; - //public $table_element='c_accounting_category'; + public $errors = array (); + public $element = 'accounting_category'; + public $table_element = 'c_accounting_category'; public $id; + public $lines_cptbk; + public $lines_display; + public $sdc; /** - * Constructor + * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ - public function __construct($db) - { + public function __construct($db) { $this->db = $db; return 1; @@ -52,122 +54,136 @@ class AccountancyCategory /** * Function to select all accounting accounts from an accounting category * - * @param int $id Id + * @param int $id Id * * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function display($id) - { + */ + public function display($id) { $sql = "SELECT t.rowid, t.account_number, t.label"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; - $sql.= " WHERE t.fk_accounting_category = " . $id; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; + $sql .= " WHERE t.fk_accounting_category = " . $id; + + $this->lines_display = array (); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $i = 0; - $obj = ''; $num = $this->db->num_rows($resql); if ($num) { - while ( $i < $num ) { - $obj[$i] = $this->db->fetch_object($resql); - $i ++; + while ( $obj = $this->db->fetch_object($resql) ) { + $this->lines_display[] = $obj; } } - return $obj; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + $this->errors[] = $this->error; + dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); - return -1; + return - 1; } } /** * Function to select accountiing category of an accounting account present in chart of accounts * - * @param int $id Id category + * @param int $id Id category * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function getCptBK($id) - { + public function getCptBK($id) { global $conf; $sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; - $sql.= " WHERE t.numero_compte NOT IN ("; - $sql.= " SELECT t.account_number"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; - $sql.= " WHERE t.fk_accounting_category = " . $id .")"; - $sql.= " AND t.numero_compte IN ("; - $sql.= " SELECT DISTINCT aa.account_number"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; - $sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; - $sql.= " AND aa.active = 1)"; - $sql.= " GROUP BY t.numero_compte"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; + $sql .= " WHERE t.numero_compte NOT IN ("; + $sql .= " SELECT t.account_number"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; + $sql .= " WHERE t.fk_accounting_category = " . $id . ")"; + $sql .= " AND t.numero_compte IN ("; + $sql .= " SELECT DISTINCT aa.account_number"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; + $sql .= " AND aa.active = 1)"; + $sql .= " GROUP BY t.numero_compte, t.label_compte, t.doc_ref"; + $sql .= " ORDER BY t.numero_compte"; - dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); + $this->lines_CptBk = array (); + + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $i = 0; - $obj = ''; $num = $this->db->num_rows($resql); if ($num) { - while ( $i < $num ) { - $obj[$i] = $this->db->fetch_object($resql); - $i ++; + while ( $obj = $this->db->fetch_object($resql) ) { + $this->lines_cptbk[] = $obj; } } - return $obj; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + $this->errors[] = $this->error; + dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); - return -1; + return - 1; } } - + /** * Function to add an accounting account in an accounting category * - * @param int $id_cat Id category - * @param array $cpts list of accounts array + * @param int $id_cat Id category + * @param array $cpts list of accounts array * * @return int <0 if KO, >0 if OK */ - public function updateAccAcc($id_cat, $cpts = array()) - { + public function updateAccAcc($id_cat, $cpts = array()) { global $conf; $error = 0; - $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; - $sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; - $sql.= " AND aa.active = 1"; - $sql.= " SET fk_accounting_category=" . $id_cat; - $sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")"; - $this->db->begin(); + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); + $sql = "SELECT aa.rowid,aa.account_number "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; + $sql .= " AND aa.active = 1"; + + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error ++; $this->errors[] = "Error " . $this->db->lasterror(); + return -1; + } + + $this->db->begin(); + while ( $obj = $this->db->fetch_object($resql)) { + if (array_key_exists(length_accountg($obj->account_number), $cpts)) { + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account"; + $sql .= " SET fk_accounting_category=" . $id_cat; + $sql .= " WHERE rowid=".$obj->rowid; + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error ++; + $this->errors[] = "Error " . $this->db->lasterror(); + } + } } // Commit or rollback if ($error) { - foreach ($this->errors as $errmsg) { + foreach ( $this->errors as $errmsg ) { dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); - $this->error.=($this->error ? ', ' . $errmsg : $errmsg); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return -1 * $error; + return - 1 * $error; } else { $this->db->commit(); @@ -178,17 +194,16 @@ class AccountancyCategory /** * Function to delete an accounting account from an accounting category * - * @param int $cpt_id Id of accounting account + * @param int $cpt_id Id of accounting account * * @return int <0 if KO, >0 if OK */ - public function deleteCptCat($cpt_id) - { + public function deleteCptCat($cpt_id) { $error = 0; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; - $sql.= " SET fk_accounting_category= 0"; - $sql.= " WHERE aa.rowid= " . $cpt_id; + $sql .= " SET fk_accounting_category= 0"; + $sql .= " WHERE aa.rowid= " . $cpt_id; $this->db->begin(); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); @@ -200,13 +215,13 @@ class AccountancyCategory // Commit or rollback if ($error) { - foreach ($this->errors as $errmsg) { + foreach ( $this->errors as $errmsg ) { dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); - $this->error.=($this->error ? ', ' . $errmsg : $errmsg); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); } $this->db->rollback(); - return -1 * $error; + return - 1 * $error; } else { $this->db->commit(); @@ -217,57 +232,51 @@ class AccountancyCategory /** * Function to know all category from accounting account * - * @return array Result in table + * @return array Result in table */ - public function getCatsCpts() - { + public function getCatsCpts() { global $mysoc; $sql = ""; - if (empty($mysoc->country_id) && empty($mysoc->country_code)) - { - dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); - exit; - } + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { + dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); + exit(); + } - if (! empty($mysoc->country_id)) - { - $sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens "; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat"; - $sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql.= " WHERE c.active = 1"; - $sql.= " AND c.fk_country = ".$mysoc->country_id.")"; - $sql.= " AND cat.rowid = t.fk_accounting_category"; - $sql.= " ORDER BY cat.position ASC"; - } - else - { - $sql = "SELECT c.rowid, c.code, c.label, c.category_type "; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; - $sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid"; - $sql.= " AND co.code = '".$mysoc->country_code."'"; - $sql.= " ORDER BY c.position ASC"; - } - - $resql = $this->db->query($sql); + if (! empty($mysoc->country_id)) { + $sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat"; + $sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; + $sql .= " WHERE c.active = 1"; + $sql .= " AND c.fk_country = " . $mysoc->country_id . ")"; + $sql .= " AND cat.rowid = t.fk_accounting_category"; + $sql .= " ORDER BY cat.position ASC"; + } else { + $sql = "SELECT c.rowid, c.code, c.label, c.category_type "; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co"; + $sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid"; + $sql .= " AND co.code = '" . $mysoc->country_code . "'"; + $sql .= " ORDER BY c.position ASC"; + } + + $resql = $this->db->query($sql); if ($resql) { $i = 0; $obj = ''; $num = $this->db->num_rows($resql); - $data = array(); + $data = array (); if ($num) { - while ( $i < $num ) { - $obj = $this->db->fetch_object($resql); + while ( $obj = $this->db->fetch_object($resql) ) { $name_cat = $obj->name_cat; - $data[$name_cat][$i] = array( - 'id' => $obj->rowid, - 'code' => $obj->code, - 'position' => $obj->position, - 'account_number' => $obj->account_number, - 'name_cpt' => $obj->name_cpt, - 'sens' => $obj->sens, - ); + $data[$name_cat][$i] = array ( + 'id' => $obj->rowid, + 'code' => $obj->code, + 'position' => $obj->position, + 'account_number' => $obj->account_number, + 'name_cpt' => $obj->name_cpt, + 'sens' => $obj->sens + ); $i ++; } } @@ -276,29 +285,28 @@ class AccountancyCategory $this->error = "Error " . $this->db->lasterror(); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); - return -1; + return - 1; } - } + } /** * Function to show result of an accounting account from the general ledger with a sens and a period - * - * @param int $cpt Id accounting account - * @param string $month Specifig month - Can be empty - * @param string $year Specific year - * @param int $sens Sens of the account 0: credit - debit 1: debit - credit * - * @return array Result in table + * @param int $cpt Id accounting account + * @param string $month Specifig month - Can be empty + * @param string $year Specific year + * @param int $sens Sens of the account 0: credit - debit 1: debit - credit + * + * @return array Result in table */ - public function getResult($cpt, $month, $year, $sens) - { - $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; - $sql.= " WHERE t.numero_compte = " . $cpt; - $sql.= " AND YEAR(t.doc_date) = " . $year; + public function getResult($cpt, $month, $year, $sens) { + $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; + $sql .= " WHERE t.numero_compte = '" . $cpt."'"; + $sql .= " AND YEAR(t.doc_date) = " . $year; - if(! empty($month)){ - $sql.= " AND MONTH(t.doc_date) = " . $month; + if (! empty($month)) { + $sql .= " AND MONTH(t.doc_date) = " . $month; } dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); @@ -306,81 +314,77 @@ class AccountancyCategory if ($resql) { $num = $this->db->num_rows($resql); - $sdc = 0; + $this->sdc = 0; if ($num) { $obj = $this->db->fetch_object($resql); - if($sens == 1){ - $sdc = $obj->debit - $obj->credit; - }else{ - $sdc = $obj->credit - $obj->debit; + if ($sens == 1) { + $this->sdc = $obj->debit - $obj->credit; + } else { + $this->sdc = $obj->credit - $obj->debit; } } - return $sdc; + return $num; } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); - return -1; + return - 1; } } /** * Function to call category from a specific country * - * @return array Result in table + * @return array Result in table */ - public function getCatsCal() - { - global $db,$langs,$user,$mysoc; + public function getCatsCal() { + global $db, $langs, $user, $mysoc; - if (empty($mysoc->country_id) && empty($mysoc->country_code)) - { - dol_print_error('','Call to select_accounting_account with mysoc country not yet defined'); - exit; - } + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { + dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); + exit(); + } - if (! empty($mysoc->country_id)) - { - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql.= " WHERE c.active = 1 AND c.category_type = 1 "; - $sql.= " AND c.fk_country = ".$mysoc->country_id; - $sql.= " ORDER BY c.position ASC"; - } - else - { - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; - $sql.= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid"; - $sql.= " AND co.code = '".$mysoc->country_code."'"; - $sql.= " ORDER BY c.position ASC"; - } + if (! empty($mysoc->country_id)) { + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; + $sql .= " WHERE c.active = 1 AND c.category_type = 1 "; + $sql .= " AND c.fk_country = " . $mysoc->country_id; + $sql .= " ORDER BY c.position ASC"; + } else { + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co"; + $sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid"; + $sql .= " AND co.code = '" . $mysoc->country_code . "'"; + $sql .= " ORDER BY c.position ASC"; + } - dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); + dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $i = 0; $obj = ''; $num = $this->db->num_rows($resql); - $data = array(); + $data = array (); if ($num) { while ( $i < $num ) { $obj = $this->db->fetch_object($resql); $position = $obj->position; - $data[$position] = array( - 'code' => $obj->code, - 'label' => $obj->label, - 'formula' => $obj->formula - ); + $data[$position] = array ( + 'code' => $obj->code, + 'label' => $obj->label, + 'formula' => $obj->formula + ); $i ++; } } return $data; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + $this->errors[] = $this->error; + dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); - return -1; + return - 1; } } } diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index 72a4d6e96b2..c9c1a13fd14 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -53,7 +53,7 @@ if ($year == 0) { } if($cat_id == 0){ - $cat_id = null; + $cat_id = null; } // Security check @@ -76,31 +76,31 @@ $textprevyear = '
' . img_next() . ''; print load_fiche_titre($langs->trans('ReportInOut') . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); - + print ''; - -$months = array( $langs->trans("JanuaryMin"), - $langs->trans("FebruaryMin"), - $langs->trans("MarchMin"), - $langs->trans("AprilMin"), - $langs->trans("MayMin"), - $langs->trans("JuneMin"), - $langs->trans("JulyMin"), - $langs->trans("AugustMin"), - $langs->trans("SeptemberMin"), - $langs->trans("OctoberMin"), - $langs->trans("NovemberMin"), + +$months = array( $langs->trans("JanuaryMin"), + $langs->trans("FebruaryMin"), + $langs->trans("MarchMin"), + $langs->trans("AprilMin"), + $langs->trans("MayMin"), + $langs->trans("JuneMin"), + $langs->trans("JulyMin"), + $langs->trans("AugustMin"), + $langs->trans("SeptemberMin"), + $langs->trans("OctoberMin"), + $langs->trans("NovemberMin"), $langs->trans("DecemberMin"), ); print ''; print ''; -print ''; +print ''; print ''; foreach($months as $k => $v){ print ''; } -print ''; +print ''; $cats = $AccCat->getCatsCpts(); $catsCalcule = $AccCat->getCatsCal(); @@ -123,22 +123,41 @@ if(!empty($cats)) $position = $cpt['position']; $code = $cpt['code']; - $resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); - $resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); + $return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultNP=0; + } else { + $resultNP=$AccCat->sdc; + } + + $return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultN=0; + } else { + $resultN=$AccCat->sdc; + } $sommes[$code]['NP'] += $resultNP; - $sommes[$code]['N'] += $resultN; + $sommes[$code]['N'] += $resultN; print ''; print ''; print ''; print ''; print ''; - + foreach($months as $k => $v){ - $resultM = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']); + $return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultM=0; + } else { + $resultM=$AccCat->sdc; + } $sommes[$code]['M'][$k] += $resultM; print ''; } - + print "\n"; } @@ -168,9 +187,9 @@ if(!empty($cats)) } $result = strtr($formula, $vars); eval( '$result = (' . $result . ');' ); - print ''; + print ''; $sommes[$code]['N'] += $result; - + // Detail by month foreach($months as $k => $v){ foreach($sommes as $code => $det){ @@ -181,14 +200,14 @@ if(!empty($cats)) print ''; $sommes[$code]['M'][$k] += $result; } - + //print ''; print "\n"; unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage } $j++; } - + // Others calculed category foreach($catsCalcule as $p => $catc) { @@ -215,7 +234,7 @@ if(!empty($cats)) } $result = strtr($formula, $vars); eval( '$result = (' . $result . ');' ); - print ''; + print ''; $sommes[$code]['N'] += $result; // Detail by month diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 03b450aa275..af51e01c576 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -71,7 +71,7 @@ class modAccounting extends DolibarrModules $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module $this->phpmin = array(5, 3); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(3, 7); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module $this->langfiles = array("accountancy"); // Constants @@ -179,7 +179,7 @@ class modAccounting extends DolibarrModules $this->const[18] = array ( "ACCOUNTING_EXPORT_GLOBAL_ACCOUNT", "yesno", - "1" + "1" ); $this->const[19] = array ( "ACCOUNTING_EXPORT_LABEL", @@ -189,12 +189,12 @@ class modAccounting extends DolibarrModules $this->const[20] = array ( "ACCOUNTING_EXPORT_AMOUNT", "yesno", - "1" + "1" ); $this->const[21] = array ( "ACCOUNTING_EXPORT_DEVISE", "yesno", - "1" + "1" ); */ $this->const[22] = array( @@ -270,7 +270,7 @@ class modAccounting extends DolibarrModules $this->rights[$r][4] = 'fiscalyear'; $this->rights[$r][5] = ''; $r++; - + $this->rights[$r][0] = 50440; $this->rights[$r][1] = 'Manage chart of accounts'; $this->rights[$r][2] = 'r'; From d1850be261fc08068a754ee7db1b184ca2739a83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 17:00:05 +0200 Subject: [PATCH 065/144] Fix conflict in leftmenu value for projet menu --- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 16 ++++++++-------- htdocs/projet/list.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 2df0bf6fdef..e77cfae7a47 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -82,7 +82,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m $url = $shorturl = $tmp[0]; $param = (isset($tmp[1])?$tmp[1]:''); - if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + if (! preg_match('/mainmenu/i',$param) && ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url,1).($param?'?'.$param:''); $shorturl = $shorturl.($param?'?'.$param:''); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9c9880c8ed1..59d1b4ff47e 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1185,9 +1185,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("projects"); // Project affected to user - $newmenu->add("/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects'); - $newmenu->add("/projet/card.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/list.php?leftmenu=projects&mode=mine&search_status=1", $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/index.php?leftmenu=myprojects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects'); + $newmenu->add("/projet/card.php?leftmenu=myprojects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/list.php?leftmenu=myprojects&mode=mine&search_status=1", $langs->trans("List"), 1, $user->rights->projet->lire); // All project i have permission on $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects'); @@ -1198,10 +1198,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Project affected to user - $newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); - $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/tasks/list.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add("/projet/activity/perweek.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/activity/index.php?leftmenu=mytasks&mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); + $newmenu->add("/projet/tasks.php?leftmenu=mytasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $newmenu->add("/projet/tasks/list.php?leftmenu=mytasks&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/activity/perweek.php?leftmenu=mytasks&mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); // All project i have permission on $newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire); @@ -1461,7 +1461,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $url = $shorturl = $tmp[0]; $param = (isset($tmp[1])?$tmp[1]:''); - if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + if (! preg_match('/mainmenu/i',$param) && ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url,1).($param?'?'.$param:''); $shorturl = $shorturl.($param?'?'.$param:''); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index faac1a20e10..a5addbc705a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -416,7 +416,7 @@ if ($resql) if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'],$_SERVER["PHP_SELF"],'p.opp_percent',"",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'],$_SERVER["PHP_SELF"],'p.budget_amount',"",$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { From 34fddbf3bcc33a764f606228a47994b25b522982 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 29 Jun 2016 17:30:47 +0200 Subject: [PATCH 066/144] addd export cogilog --- .../class/accountancyexport.class.php | 36 +++++++++++++++++++ htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 37 insertions(+) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index c7920577adc..04f66a47026 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -43,6 +43,7 @@ class AccountancyExport public static $EXPORT_TYPE_CIEL = 5; public static $EXPORT_TYPE_QUADRATUS = 6; public static $EXPORT_TYPE_EBP = 7; + public static $EXPORT_TYPE_COGILOG = 8; /** * @@ -91,6 +92,7 @@ class AccountancyExport self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'), self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), + self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), ); } @@ -137,6 +139,9 @@ class AccountancyExport case self::$EXPORT_TYPE_EBP : $this->exportEbp($TData); break; + case self::$EXPORT_TYPE_COGILOG : + $this->exportCogilog($TData); + break; default : $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; @@ -188,6 +193,37 @@ class AccountancyExport } } + /** + * Export format : COGILOG + * + * @param array $objectLines data + * + * @return void + */ + public function exportCogilog($objectLines) { + foreach ( $objectLines as $line ) { + $date = dol_print_date($line->doc_date, '%d%m%Y'); + + print $line->code_journal . $this->separator; + print $date . $this->separator; + print $line->piece_num . $this->separator; + print length_accountg($line->numero_compte) . $this->separator; + print '' . $this->separator; + print $line->label_compte . $this->separator; + print $date . $this->separator; + if ($line->sens=='D') { + print price($line->montant) . $this->separator; + print '' . $this->separator; + }elseif ($line->sens=='C') { + print '' . $this->separator; + print price($line->montant) . $this->separator; + } + print $line->doc_ref . $this->separator; + print $line->label_compte . $this->separator; + print $this->end_line; + } + } + /** * Export format : COALA * diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 433d5a0178d..9a12afd3953 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -147,6 +147,7 @@ Modelcsv_bob50=Export towards Sage BOB 50 Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution Modelcsv_quadratus=Export towards Quadratus QuadraCompta Modelcsv_ebp=Export towards EBP +Modelcsv_cogilog=Export towards Cogilog ## Tools - Init accounting account on product / service InitAccountancy=Init accountancy From e8b4a3a8ae663d972dbe83e456c2d0c14cae8525 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 17:34:13 +0200 Subject: [PATCH 067/144] Code comment --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 979c2622ae3..9e9cf97706c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4093,7 +4093,7 @@ select { /* display: inline-block; */ /* We can't set this. This disable ability to make */ /* TODO modified by jmobile, replace jmobile with pure css*/ overflow:hidden; - white-space: nowrap; + white-space: nowrap; /* Enabling this make behaviour strange when selecting the empty value if this empty value is '' instead of ' ' */ text-overflow: ellipsis; } .fiche .ui-controlgroup { From f7427e7366c0eef8ef848b8845acf6f76333ef46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 18:15:35 +0200 Subject: [PATCH 068/144] Fix css --- htdocs/expensereport/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index f046b4ea61f..e177312a7d6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1432,7 +1432,7 @@ else { $num = $db->num_rows($resql); $i = 0; $total = 0; - print '
'.$langs->trans("Account").''.$langs->trans("Description").'N-1N-1'.$langs->trans("NReal").''.$langs->trans($v).'
' . $cpt['account_number'] . '' . $cpt['name_cpt'] . '' . price($resultNP) . '' . price($resultN) . '' . price($resultM) . '
' . price($result) . '' . price($result) . '' . price($result) . '' . $catsCalcule[$p]['formula'] . '
' . price($result) . '' . price($result) . '
'; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d14a43764d7..d0edbd1f458 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1736,7 +1736,7 @@ else { $num = $db->num_rows($result); $i = 0; $totalpaye = 0; - print '
'.$langs->trans("RefPayment").''.$langs->trans("Date").'
'; + print '
'; print ''; print ''; print ''; From 0be23553a4c4f47e339d39ab2c71ae8cdd39a037 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 19:43:42 +0200 Subject: [PATCH 069/144] Fix menu closing --- htdocs/core/menus/standard/auguria.lib.php | 10 +++++++++- htdocs/core/menus/standard/eldy.lib.php | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index e77cfae7a47..17079bc96ac 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -82,7 +82,15 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m $url = $shorturl = $tmp[0]; $param = (isset($tmp[1])?$tmp[1]:''); - if (! preg_match('/mainmenu/i',$param) && ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url'])) + { + $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu='; + } + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url'])) + { + $param.=($param?'&':'').'leftmenu='; + } //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url,1).($param?'?'.$param:''); $shorturl = $shorturl.($param?'?'.$param:''); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 59d1b4ff47e..8b6e43d0de8 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -857,8 +857,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("donations"); $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations'); - if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); - if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php",$langs->trans("List"), 1, $user->rights->don->lire); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?leftmenu=donations&action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); + if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php?leftmenu=donations",$langs->trans("List"), 1, $user->rights->don->lire); // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); } @@ -1459,9 +1459,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $tmp=explode('?',$menu_array[$i]['url'],2); $url = $shorturl = $tmp[0]; - $param = (isset($tmp[1])?$tmp[1]:''); - - if (! preg_match('/mainmenu/i',$param) && ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; + $param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link + + // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu'])) + { + $param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; + } + if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($menu_array[$i]['mainmenu'])) + { + $param.=($param?'&':'').'leftmenu='; + } //$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad $url = dol_buildpath($url,1).($param?'?'.$param:''); $shorturl = $shorturl.($param?'?'.$param:''); From 383641e086339861fba6329bfa1f5428387b2f10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jun 2016 20:08:47 +0200 Subject: [PATCH 070/144] Test package vcredist is available --- build/exe/doliwamp/doliwamp.iss | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 8c6130437ac..f302c9a2b57 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -255,9 +255,7 @@ begin // Prepare an object calle "Page" of type wpInstalling. // Object will be show later in NextButtonClick function. - Page := CreateInputQueryPage(wpInstalling, - CustomMessage('TechnicalParameters'), '', - CustomMessage('IfFirstInstall')); + Page := CreateInputQueryPage(wpInstalling, CustomMessage('TechnicalParameters'), '', CustomMessage('IfFirstInstall')); // TODO Add control differently if first install or update if firstinstall @@ -334,6 +332,19 @@ begin exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17'; exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17'; + + //---------------------------------------------- + // Test if VC11Redist has been installed + //---------------------------------------------- + + if not FileExists ('c:/windows/system32/msvcr70.dll') and not FileExists ('c:/windows/sysWOW64/msvcr70.dll') and not FileExists ('c:/winnt/system32/msvcr70.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr70.dll') then + begin + // TODO Copy file or ask to install package ? + //CustomMessage('YouWillInstallDoliWamp')+#13#13 + MsgBox('The package vcredist_x64.exe or vcredist_86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); + end; + + // If we have a new database version, we should only copy old my.ini file into new directory // and change only all basedir= strings to use new version. Like this, data dir is still correct. // Install of service and stop/start scripts are already rebuild by installer. From 5950178c7a3a8c62ae7e211e530fb9b823259cd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jun 2016 00:38:13 +0200 Subject: [PATCH 071/144] Fix create of admin user --- htdocs/install/step5.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index f880da8b854..9182c7cd9c2 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -178,9 +178,12 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity); } + // Create user used to create the admin user $createuser=new User($db); $createuser->id=0; - + $createuser->admin=1; + + // Set admin user $newuser = new User($db); $newuser->lastname='SuperAdmin'; $newuser->firstname=''; From e4a2b5abb372eeb43a7d46d507344fdd6cea7a5f Mon Sep 17 00:00:00 2001 From: fmarcet Date: Thu, 30 Jun 2016 11:27:29 +0200 Subject: [PATCH 072/144] Fix: Incorrect document link on supplier invoices's list --- htdocs/core/class/html.formfile.class.php | 4 +--- htdocs/fourn/facture/list.php | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 48dc7a3ebf2..3faedf4b601 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2016 Ferran Marcet * 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 @@ -716,9 +717,6 @@ class FormFile if ($modulepart == 'export') { $relativepath = $file["name"]; } - if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') { - $relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"]; - } // Show file name with link to download $out.= 'getNomUrl(1); $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir); + $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); print "\n"; // Ref supplier From 1740166d287aa4704f04fbde1f731dee9973c0a6 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 14:16:41 +0200 Subject: [PATCH 073/144] FIX :#5416 --- htdocs/multicurrency/class/multicurrency.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 9b203ea0424..6bfa3502149 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -493,7 +493,7 @@ class MultiCurrency extends CommonObject */ public static function getIdFromCode(&$db, $code) { - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = "'.$db->escape($code).'"'; + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\''; $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid; else return 0; From c73c1a577adb9d8c6614dc21def9992c0954a72f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 14:24:03 +0200 Subject: [PATCH 074/144] Time spent can be saved with project read right --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 02fa370fc13..7fc6be32725 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -53,7 +53,7 @@ $projectstatic = new Project($db); * Actions */ -if ($action == 'addtimespent' && $user->rights->projet->creer) +if ($action == 'addtimespent' && $user->rights->projet->lire) { $error=0; From 542be965b3ca853f8f4d1a2a7641d9f25021ef89 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 14:24:55 +0200 Subject: [PATCH 075/144] add log and toher multicurrency bug fix for PgSQL --- .../class/multicurrency.class.php | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 6bfa3502149..c2c6ba1bc99 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -140,6 +140,7 @@ class MultiCurrency extends CommonObject $this->db->begin(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -184,9 +185,10 @@ class MultiCurrency extends CommonObject $sql = 'SELECT'; $sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c'; - if (!empty($code)) $sql .= ' WHERE c.code = "'.$this->db->escape($code).'"'; + if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\''; else $sql .= ' WHERE c.rowid = ' . $id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -226,8 +228,6 @@ class MultiCurrency extends CommonObject */ public function fetchAllCurrencyRate() { - dol_syslog('Currency::fetchAllCurrencyRate', LOG_DEBUG); - $sql = 'SELECT cr.rowid'; $sql.= ' FROM ' . MAIN_DB_PREFIX . $this->table_element_line. ' as cr'; $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; @@ -235,6 +235,7 @@ class MultiCurrency extends CommonObject $this->rates = array(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -284,10 +285,11 @@ class MultiCurrency extends CommonObject // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' name="'.$this->db->escape($this->name).'"'; - $sql .= ' code="'.$this->db->escape($this->code).'"'; + $sql .= ' name=\''.$this->db->escape($this->name).'\''; + $sql .= ' code=\''.$this->db->escape($this->code).'\''; $sql .= ' WHERE rowid=' . $this->id; + dol_syslog(__METHOD__,LOG_DEBUG); $this->db->begin(); $resql = $this->db->query($sql); @@ -347,6 +349,7 @@ class MultiCurrency extends CommonObject $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -425,7 +428,9 @@ class MultiCurrency extends CommonObject $currency->code = $code; $currency->name = $code; - $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = "'.$db->escape($code).'"'; + $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = \''.$db->escape($code).'\''; + + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { @@ -475,6 +480,7 @@ class MultiCurrency extends CommonObject $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; $sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)'; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql && ($obj = $this->db->fetch_object($resql))) { $this->rate = new CurrencyRate($this->db); @@ -494,6 +500,8 @@ class MultiCurrency extends CommonObject public static function getIdFromCode(&$db, $code) { $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\''; + + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid; else return 0; @@ -512,10 +520,11 @@ class MultiCurrency extends CommonObject { $sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; - $sql.= ' WHERE m.code = "'.$db->escape($code).'"'; + $sql.= ' WHERE m.code = \''.$db->escape($code).'\''; $sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")"; $sql.= ' ORDER BY mc.date_sync DESC LIMIT 1'; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate); else return array(0, 1); @@ -556,6 +565,8 @@ class MultiCurrency extends CommonObject global $db; $sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture; + + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { @@ -721,6 +732,7 @@ class CurrencyRate extends CommonObjectLine $this->db->begin(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -765,6 +777,7 @@ class CurrencyRate extends CommonObjectLine $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS cr'; $sql .= ' WHERE cr.rowid = ' . $id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $numrows = $this->db->num_rows($resql); @@ -816,6 +829,7 @@ class CurrencyRate extends CommonObjectLine $this->db->begin(); + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; @@ -866,6 +880,7 @@ class CurrencyRate extends CommonObjectLine $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' WHERE rowid='.$this->id; + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error ++; From 22bc44620b8f2733009867e6a6ca6c9065b5dbc6 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 30 Jun 2016 14:27:58 +0200 Subject: [PATCH 076/144] FIX #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option --- htdocs/core/lib/pdf.lib.php | 14 ++++++++++---- .../core/modules/facture/doc/pdf_crabe.modules.php | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6389c71b06c..9fe2bbb1b40 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1342,7 +1342,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $hookmanager,$conf; + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) { @@ -1355,7 +1358,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) } else { - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); + if (empty($hidedetails) || $hidedetails > 1) return price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs); } } @@ -1629,7 +1632,10 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $hookmanager,$conf; + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if ($object->lines[$i]->special_code == 3) { @@ -1648,7 +1654,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) } else { - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); + if (empty($hidedetails) || $hidedetails > 1) return price($sign * (($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs); } } return ''; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 719449bcbd4..33febb9028b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -539,13 +539,16 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress(); if ($prev_progress > 0) // Compute progress from previous situation { - $tvaligne = $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; + $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { - $tvaligne = $object->lines[$i]->total_tva; + $tvaligne = $sign * $object->lines[$i]->total_tva; } $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; From 97fe75f198de42b116db78a0ecb21f281eca7bfc Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 14:57:23 +0200 Subject: [PATCH 077/144] FIX #5004 --- htdocs/societe/consumption.php | 70 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index e07e13ef751..ea2cb899893 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -280,43 +280,45 @@ if ($type_element == 'contract') $thirdTypeSelect='customer'; } -$sql = $sql_select; -$sql.= ' d.description as description,'; -if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; -if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; -if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; -$sql.= " s.rowid as socid "; -if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; -if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; -$sql.= $where; -if ($month > 0) { - if ($year > 0) { - $start = dol_mktime(0, 0, 0, $month, 1, $year); - $end = dol_time_plus_duree($start,1,'m') - 1; +if(!empty($sql_select)) { + $sql = $sql_select; + $sql.= ' d.description as description,'; + if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; + if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; + if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; + $sql.= " s.rowid as socid "; + if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; + if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; + $sql.= $where; + if ($month > 0) { + if ($year > 0) { + $start = dol_mktime(0, 0, 0, $month, 1, $year); + $end = dol_time_plus_duree($start,1,'m') - 1; + $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; + } else { + $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; + } + } else if ($year > 0) { + $start = dol_mktime(0, 0, 0, 1, 1, $year); + $end = dol_time_plus_duree($start,1,'y') - 1; $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; - } else { - $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; } -} else if ($year > 0) { - $start = dol_mktime(0, 0, 0, 1, 1, $year); - $end = dol_time_plus_duree($start,1,'y') - 1; - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; + if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; + if ($sprod_fulldescr) + { + $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; + $sql.=")"; + } + $sql.= $db->order($sortfield,$sortorder); + + $resql=$db->query($sql); + $totalnboflines = $db->num_rows($resql); + + $sql.= $db->plimit($limit + 1, $offset); } -if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; -if ($sprod_fulldescr) -{ - $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; - $sql.=")"; -} -$sql.= $db->order($sortfield,$sortorder); - -$resql=$db->query($sql); -$totalnboflines = $db->num_rows($resql); - -$sql.= $db->plimit($limit + 1, $offset); //print $sql; // Define type of elements From 02169478d03e86ae3b8ec1c57373b30376cb5d37 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 30 Jun 2016 15:30:07 +0200 Subject: [PATCH 078/144] FIX #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines --- htdocs/expedition/class/expedition.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1b7fbefb8a6..a15c3b53b83 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1266,7 +1266,7 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; - $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent"; + $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; @@ -1336,6 +1336,8 @@ class Expedition extends CommonObject $line->volume = $obj->volume; $line->volume_units = $obj->volume_units; + $line->pa_ht = $obj->pa_ht; + // For invoicing $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) From 0ffe106e2cdb7cfa5213a93a12baf3fc89026267 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 16:03:48 +0200 Subject: [PATCH 079/144] FIX #4749 --- htdocs/compta/bank/annuel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 68ef0a42e32..61941a4cefb 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -36,10 +36,10 @@ $id=GETPOST('account'); $ref=GETPOST('ref'); // Security check -$fieldid = (! empty($ref)?$ref:$id); -$fieldname = isset($ref)?'ref':'rowid'; +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); +$fieldtype = (! empty($ref) ? 'ref' :'rowid'); if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname); +$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype); $year_start=GETPOST('year_start'); $year_current = strftime("%Y",time()); @@ -146,7 +146,7 @@ $linkback = ''.$langs->trans("B // Ref print ''; print ''; print ''; - if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) + if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid) { $showconfirminfo['rowid']=$obj->rowid; $showconfirminfo['amount_ttc']=$obj->amount_ttc; From 38dcb0de4988a9a632db69b1f96278983615f042 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 16:53:24 +0200 Subject: [PATCH 083/144] FIX #4455 --- htdocs/fourn/card.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 5188003c115..956d4b52452 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -407,6 +407,18 @@ if ($object->id > 0) } // TODO move to DAO class + $sql = "SELECT count(p.rowid) as total"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; + $sql.= " WHERE p.fk_soc =".$object->id; + $sql.= " AND p.entity =".$conf->entity; + $sql.= " ORDER BY p.date_commande DESC"; + $resql=$db->query($sql); + if ($resql) + { + $object_count = $db->fetch_object($resql); + $num = $object_count->total; + } + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; @@ -417,7 +429,6 @@ if ($object->id > 0) if ($resql) { $i = 0 ; - $num = $db->num_rows($resql); if ($num > 0) { @@ -433,7 +444,7 @@ if ($object->id > 0) } $var = True; - while ($i < $num && $i <= $MAXLIST) + while ($i < $num && $i < $MAXLIST) { $obj = $db->fetch_object($resql); $var=!$var; From 8097298c805e96dee8427bfc0299da2817e03d7f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 16:55:59 +0200 Subject: [PATCH 084/144] FIX #4756 --- htdocs/install/pgsql/functions/functions.sql | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 768eb853ca2..d61976fbb36 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -63,7 +63,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH RO CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_advtargetemailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -96,7 +95,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_documents FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directory FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -128,7 +127,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_donation FOR CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printer_ipp FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -155,8 +153,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_rib FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_stock_mouvement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_time_basket FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_timebasket_counter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 855550e2742525e65aa2944366f0c03946e68f15 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 17:00:09 +0200 Subject: [PATCH 085/144] FIX 4926 --- htdocs/install/pgsql/functions/functions.sql | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index e93769f1e2a..46bb9223222 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -63,10 +63,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH RO CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_advtargetemailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -96,7 +92,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_documents FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directory FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -155,8 +151,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_rib FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_socpeople_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_stock_mouvement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_time_basket FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_timebasket_counter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_tva FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From d004f3a538c6a0907ea75cb2e07671f47a775bc9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 17:03:56 +0200 Subject: [PATCH 086/144] FIX #4448 $filebonprev is not used, $this->filename now --- .../compta/prelevement/class/bonprelevement.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 610fe257732..8fd5450d66a 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -918,7 +918,10 @@ class BonPrelevement extends CommonObject $row = $this->db->fetch_row($resql); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT); - $this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml'; + $dir=$conf->prelevement->dir_output.'/receipts'; + if (! is_dir($dir)) dol_mkdir($dir); + + $this->filename = $dir.'/receipts/'.$ref.'.xml'; // Create withdraw receipt in database $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; @@ -934,10 +937,6 @@ class BonPrelevement extends CommonObject { $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $this->id = $prev_id; - - $dir=$conf->prelevement->dir_output.'/receipts'; - $file=$filebonprev; - if (! is_dir($dir)) dol_mkdir($dir); } else { @@ -1033,7 +1032,7 @@ class BonPrelevement extends CommonObject // Generation of SEPA file $this->generate(); } - dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG); + dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } /* From 37ee64ae9ba24a70ef2def4e2168e0d7db363c0e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 17:10:06 +0200 Subject: [PATCH 087/144] fix 4672 --- htdocs/comm/mailing/advtargetemailing.php | 8 +++---- htdocs/core/lib/emailing.lib.php | 8 +++---- .../mailings/advthirdparties.modules.php | 22 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index be8a63225fe..9cd40a55b8b 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -221,7 +221,7 @@ if ($action == 'add') { if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) { // Add targets into database $obj = new mailing_advthirdparties($db); - $result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); + $result = $obj->add_to_target_spec($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); } else { $result = 0; } @@ -967,11 +967,11 @@ if ($object->fetch($id) >= 0) { print ''; print '
'; } - - if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) + + if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) { - // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) + // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) } } diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 443b9b6156a..9ddd05f7faa 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -39,14 +39,14 @@ function emailing_prepare_head(Mailing $object) $head[$h][2] = 'card'; $h++; - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient)) + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient)) { $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id; $head[$h][1] = $langs->trans("MailRecipients"); $head[$h][2] = 'targets'; $h++; - - if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug + + if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) { $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id; $head[$h][1] = $langs->trans("MailAdvTargetRecipients"); @@ -54,7 +54,7 @@ function emailing_prepare_head(Mailing $object) $h++; } } - + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index cba8af72295..1e04fe5459d 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -56,7 +56,7 @@ class mailing_advthirdparties extends MailingTargets * @param array $contactid Array of contact id to add * @return int <0 if error, number of emails added if ok */ - function add_to_target($mailing_id,$socid,$type_of_target, $contactid) + function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid) { global $conf, $langs; @@ -80,14 +80,14 @@ class mailing_advthirdparties extends MailingTargets { $num = $this->db->num_rows($result); $i = 0; - + dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found", LOG_DEBUG); - + $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); - + if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) { if (!array_key_exists($obj->email, $cibles)) { $cibles[$obj->email] = array( @@ -102,7 +102,7 @@ class mailing_advthirdparties extends MailingTargets ); } } - + $i++; } } @@ -129,21 +129,21 @@ class mailing_advthirdparties extends MailingTargets $sql.= " AND socp.fk_soc IN (".implode(',',$socid).")"; } $sql.= " ORDER BY email"; - + // Stock recipients emails into targets table $result=$this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); $i = 0; - + dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found"); - + $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); - + if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) { if (!array_key_exists($obj->email, $cibles)) { $cibles[$obj->email] = array( @@ -158,7 +158,7 @@ class mailing_advthirdparties extends MailingTargets ); } } - + $i++; } } @@ -202,7 +202,7 @@ class mailing_advthirdparties extends MailingTargets * * @return int Nb of recipients */ - function getNbOfRecipients() + function getNbOfRecipients($sql) { global $conf; From 215f397f33a6e279e0f6d8dc39ab80d5eff74e64 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 17:28:13 +0200 Subject: [PATCH 088/144] Cannot reproduce 4793 still fix other bug on PgSQL --- htdocs/compta/facture/class/facture.class.php | 140 +++++++++-------- htdocs/core/class/commonobject.class.php | 146 +++++++++--------- .../mysql/data/llx_accounting_category.sql | 2 +- htdocs/install/pgsql/functions/functions.sql | 4 - 4 files changed, 146 insertions(+), 146 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index aa51c63374d..73127f9a1f2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -108,7 +108,7 @@ class Facture extends CommonInvoice var $specimen; var $fac_rec; - + // Multicurrency var $fk_multicurrency; var $multicurrency_code; @@ -136,7 +136,7 @@ class Facture extends CommonInvoice * @var array Table of previous situations */ public $tab_previous_situation_invoice=array(); - + /** * @var array Table of next situations */ @@ -249,7 +249,7 @@ class Facture extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } - + dol_syslog(get_class($this)."::create user=".$user->id); // Check parameters @@ -280,7 +280,7 @@ class Facture extends CommonInvoice $result=$_facrec->fetch($this->fac_rec); $this->socid = $_facrec->socid; - + // Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI $this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project; $this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public; @@ -289,7 +289,7 @@ class Facture extends CommonInvoice $this->cond_reglement_id = GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $_facrec->cond_reglement_id; $this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id; $this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account; - + // Fields always coming from template $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; @@ -302,13 +302,13 @@ class Facture extends CommonInvoice $this->note_public=trim($this->note_public); $this->note_private=trim($this->note_private); $this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref)); - + //if (! $this->remise) $this->remise = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; $this->brouillon = 1; - + $forceduedate = $this->calculate_date_lim_reglement(); - + // For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { @@ -658,7 +658,7 @@ class Facture extends CommonInvoice function createFromCurrent($user,$invertdetail=0) { global $conf; - + // Charge facture source $facture=new Facture($this->db); @@ -712,15 +712,15 @@ class Facture extends CommonInvoice elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { $this->fetchObjectLinked('', '', $object->id, 'facture'); - - foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) + + foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) { - foreach ($Tfk_object as $fk_object) + foreach ($Tfk_object as $fk_object) { $facture->add_object_linked($typeObject, $fk_object); } } - + $facture->add_object_linked('facture', $this->fk_facture_source); } @@ -1107,7 +1107,7 @@ class Facture extends CommonInvoice $this->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - + if ($this->type == self::TYPE_SITUATION && $fetch_situation) { $this->fetchPreviousNextSituationInvoice(); @@ -1229,7 +1229,7 @@ class Facture extends CommonInvoice $line->situation_percent= $objp->situation_percent; $line->fk_prev_id = $objp->fk_prev_id; $line->fk_unit = $objp->fk_unit; - + // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; $line->multicurrency_code = $objp->multicurrency_code; @@ -1237,7 +1237,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - + $this->lines[$i] = $line; $i++; @@ -1255,17 +1255,17 @@ class Facture extends CommonInvoice /** * Fetch previous and next situations invoices * - * @return void + * @return void */ function fetchPreviousNextSituationInvoice() { global $conf; - + $this->tab_previous_situation_invoice = array(); $this->tab_next_situation_invoice = array(); - + $sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC'; - + dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG); $result = $this->db->query($sql); if ($result && $this->db->num_rows($result) > 0) @@ -1274,13 +1274,13 @@ class Facture extends CommonInvoice { $invoice = new Facture($this->db); if ($invoice->fetch($objp->rowid) > 0) - { + { if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice; else $this->tab_next_situation_invoice[] = $invoice; } } } - + } /** @@ -2061,7 +2061,7 @@ class Facture extends CommonInvoice $this->brouillon=0; $this->date_validation=$now; $i = 0; - + if (!empty($conf->global->INVOICE_USE_SITUATION)) { $final = True; @@ -2094,7 +2094,7 @@ class Facture extends CommonInvoice /** * Update price of next invoice - * + * * @param Translate $langs Translate object * @return bool false if KO, true if OK */ @@ -2103,13 +2103,13 @@ class Facture extends CommonInvoice foreach ($this->tab_next_situation_invoice as $next_invoice) { $is_last = $next_invoice->is_last_in_cycle(); - - if ($next_invoice->brouillon && $is_last != 1) + + if ($next_invoice->brouillon && $is_last != 1) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; } - + $next_invoice->brouillon = 1; foreach ($next_invoice->lines as $line) { @@ -2117,17 +2117,17 @@ class Facture extends CommonInvoice $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); - - if ($result < 0) + + if ($result < 0) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; } } - + break; // Only the next invoice and not each next invoice } - + return true; } @@ -2280,7 +2280,7 @@ class Facture extends CommonInvoice if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($fk_prev_id)) $fk_prev_id = 'null'; if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100; - + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); @@ -2342,7 +2342,7 @@ class Facture extends CommonInvoice $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Rank to use $rangtouse = $rang; if ($rangtouse == -1) @@ -2355,14 +2355,14 @@ class Facture extends CommonInvoice $this->line=new FactureLigne($this->db); $this->line->context = $this->context; - + $this->line->fk_facture=$this->id; $this->line->label=$label; // deprecated $this->line->desc=$desc; - + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise - + $this->line->tva_tx=$txtva; $this->line->localtax1_tx=$txlocaltax1; $this->line->localtax2_tx=$txlocaltax2; @@ -2374,7 +2374,7 @@ class Facture extends CommonInvoice $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); // For credit note and if qty is negative, total is negative $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); // For credit note and if qty is negative, total is negative $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); // For credit note and if qty is negative, total is negative - + $this->line->fk_product=$fk_product; $this->line->product_type=$product_type; $this->line->remise_percent=$remise_percent; @@ -2384,7 +2384,7 @@ class Facture extends CommonInvoice $this->line->rang=$rangtouse; $this->line->info_bits=$info_bits; $this->line->fk_remise_except=$fk_remise_except; - + $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; $this->line->origin=$origin; @@ -2396,7 +2396,7 @@ class Facture extends CommonInvoice // infos marge $this->line->fk_fournprice = $fk_fournprice; $this->line->pa_ht = $pa_ht; - + // Multicurrency $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; @@ -2404,7 +2404,7 @@ class Facture extends CommonInvoice $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } @@ -2489,7 +2489,7 @@ class Facture extends CommonInvoice return -3; } } - + $this->db->begin(); // Clean parameters @@ -2515,7 +2515,7 @@ class Facture extends CommonInvoice $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx); $total_ht = $tabprice[0]; @@ -2531,7 +2531,7 @@ class Facture extends CommonInvoice $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; - + // Old properties: $price, $remise (deprecated) $price = $pu; $remise = 0; @@ -2607,7 +2607,7 @@ class Facture extends CommonInvoice $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; - + if (is_array($array_options) && count($array_options)>0) { $this->line->array_options=$array_options; } @@ -2638,28 +2638,28 @@ class Facture extends CommonInvoice } /** - * Check if the percent edited is lower of next invoice line - * + * Check if the percent edited is lower of next invoice line + * * @param int $idline id of line to check * @param float $situation_percent progress percentage need to be test * @return false if KO, true if OK */ function checkProgressLine($idline, $situation_percent) { - $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd - INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) - WHERE fd.fk_prev_id = '.$idline.' + $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd + INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) + WHERE fd.fk_prev_id = '.$idline.' AND f.fk_statut <> 0'; - + $result = $this->db->query($sql); if (! $result) { $this->error=$this->db->error(); return false; } - + $obj = $this->db->fetch_object($result); - + if ($obj === null) return true; else return $situation_percent < $obj->situation_percent; } @@ -2674,7 +2674,7 @@ class Facture extends CommonInvoice function update_percent($line, $percent) { global $mysoc,$user; - + include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); // Cap percentages to 100 @@ -3555,6 +3555,10 @@ class Facture extends CommonInvoice $prodids[$i] = $row[0]; } } + //Avoid php warning Warning: mt_rand(): max(0) is smaller than min(1) when no product exists + if (empty($num_prods)) { + $num_prods=1; + } // Initialize parameters $this->id=0; @@ -3788,7 +3792,7 @@ class Facture extends CommonInvoice function get_prev_sits() { global $conf; - + $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; $sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref; $sql .= ' and situation_counter < ' . $this->situation_counter; @@ -3818,9 +3822,9 @@ class Facture extends CommonInvoice */ function setFinal() { - + $this->db->begin(); - + $this->situation_final = 1; $sql = 'update ' . MAIN_DB_PREFIX . 'facture set situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id; $resql = $this->db->query($sql); @@ -3845,12 +3849,12 @@ class Facture extends CommonInvoice function is_last_in_cycle() { global $conf; - + if (!empty($this->situation_cycle_ref)) { // No point in testing anything if we're not inside a cycle $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); - + if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); $last = $res['max(situation_counter)']; @@ -3895,7 +3899,7 @@ class Facture extends CommonInvoice // Paid invoices have status STATUS_CLOSED if ($this->statut != Facture::STATUS_VALIDATED) return false; - + return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay); } } @@ -3984,7 +3988,7 @@ class FactureLigne extends CommonInvoiceLine var $multicurrency_total_ht; var $multicurrency_total_tva; var $multicurrency_total_ttc; - + /** * Load invoice line from database * @@ -4074,7 +4078,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); // Clean parameters @@ -4100,9 +4104,9 @@ class FactureLigne extends CommonInvoiceLine if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -4286,7 +4290,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. - + // Clean parameters $this->desc=trim($this->desc); if (empty($this->tva_tx)) $this->tva_tx=0; @@ -4308,7 +4312,7 @@ class FactureLigne extends CommonInvoiceLine if ($this->product_type < 0) return -1; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { @@ -4355,13 +4359,13 @@ class FactureLigne extends CommonInvoiceLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql .= ", situation_percent=" . $this->situation_percent; $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - + // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -4477,7 +4481,7 @@ class FactureLigne extends CommonInvoiceLine /** * Returns situation_percent of the previous line. - * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. + * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. * * @param int $invoiceid Invoice id * @return int >= 0 diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 620047014d4..aa36fa74624 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -444,7 +444,7 @@ abstract class CommonObject global $conf, $langs; $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS - + $contactid=0; $thirdpartyid=0; if ($this->element == 'societe') @@ -461,12 +461,12 @@ abstract class CommonObject $contactid=$this->contact_id; $thirdpartyid=$object->fk_soc; } - + $out=''; - + $outdone=0; $coords = $this->getFullAddress(1,', '); - if ($coords) + if ($coords) { if (! empty($conf->use_javascript_ajax)) { @@ -481,7 +481,7 @@ abstract class CommonObject } if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress - && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) + && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { $out.=($outdone?' - ':'').$this->state; $outdone++; @@ -512,15 +512,15 @@ abstract class CommonObject if (! empty($this->office_fax)) { $out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++; } - + $out.='
'; $outdone=0; - if (! empty($this->email)) + if (! empty($this->email)) { $out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1); $outdone++; } - if (! empty($this->url)) + if (! empty($this->url)) { $out.=dol_print_url($this->url,'',0,1); $outdone++; @@ -531,12 +531,12 @@ abstract class CommonObject if ($this->skype) $out.=dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE'); $outdone++; } - + $out.=''; - + return $out; } - + /** * Add a link between element $this->element and a contact * @@ -592,7 +592,7 @@ abstract class CommonObject } $datecreate = dol_now(); - + $this->db->begin(); // Insertion dans la base @@ -610,9 +610,9 @@ abstract class CommonObject if (! $notrigger) { $result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user); - if ($result < 0) - { - $this->db->rollback(); + if ($result < 0) + { + $this->db->rollback(); return -1; } } @@ -883,9 +883,9 @@ abstract class CommonObject if (empty($order)) $order='position'; if ($order == 'position') $order.=',code'; - + $tab = array(); - $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; + $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types @@ -1196,7 +1196,7 @@ abstract class CommonObject if (!empty($id) && !empty($field) && !empty($table)) { $sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE rowid = ".$id; - + dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1428,7 +1428,7 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'multicurrency_code'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"'; $sql .= ' WHERE rowid='.$this->id; @@ -1436,10 +1436,10 @@ abstract class CommonObject if ($this->db->query($sql)) { $this->multicurrency_code = $code; - + list($fk_multicurrency, $rate) = MultiCurrency::getIdAndTxFromCode($this->db, $code); if ($rate) $this->setMulticurrencyRate($rate); - + return 1; } else @@ -1456,7 +1456,7 @@ abstract class CommonObject return -2; } } - + /** * Change the multicurrency rate * @@ -1469,7 +1469,7 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'multicurrency_tx'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = '.$rate; $sql .= ' WHERE rowid='.$this->id; @@ -1477,11 +1477,11 @@ abstract class CommonObject if ($this->db->query($sql)) { $this->multicurrency_tx = $rate; - + // Update line price if (!empty($this->lines)) { - foreach ($this->lines as &$line) + foreach ($this->lines as &$line) { switch ($this->element) { case 'propal': @@ -1503,10 +1503,10 @@ abstract class CommonObject dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG); break; } - + } } - + return 1; } else @@ -2244,7 +2244,7 @@ abstract class CommonObject $this->total_localtax1 += $obj->total_localtax1; $this->total_localtax2 += $obj->total_localtax2; $this->total_ttc += $obj->total_ttc; - + if (! isset($total_ht_by_vats[$obj->vatrate])) $total_ht_by_vats[$obj->vatrate]=0; if (! isset($total_tva_by_vats[$obj->vatrate])) $total_tva_by_vats[$obj->vatrate]=0; if (! isset($total_ttc_by_vats[$obj->vatrate])) $total_ttc_by_vats[$obj->vatrate]=0; @@ -2290,12 +2290,12 @@ abstract class CommonObject $this->total_ttc -= $sit->total_ttc; } } - + // Multicurrency $this->multicurrency_total_ht += $this->total_ht * $multicurrency_tx; $this->multicurrency_total_tva += $this->total_tva * $multicurrency_tx; $this->multicurrency_total_ttc += $this->total_ttc * $multicurrency_tx; - + $this->db->free($resql); // Now update global field total_ht, total_ttc and tva @@ -2398,8 +2398,8 @@ abstract class CommonObject * - all parameters empty -> we look all link to current object (current object can be source or target) * - one couple id+type is provided -> this will set $justsource or $justtarget * - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type - * - * + * + * * @param int $sourceid Object source id (if not defined, id of object) * @param string $sourcetype Object source type (if not defined, element name of object) * @param int $targetid Object target id (if not defined, id of object) @@ -2508,7 +2508,7 @@ abstract class CommonObject { // Parse element/subelement (ex: project_task) $module = $element = $subelement = $objecttype; - if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' + if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) { $module = $element = $regs[1]; @@ -2544,10 +2544,10 @@ abstract class CommonObject else if ($objecttype == 'subscription') { $classpath = 'adherents/class'; $module = 'adherent'; } - + // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); - + if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; } @@ -2563,7 +2563,7 @@ abstract class CommonObject else if ($objecttype == 'subscription') { $classfile = 'cotisation'; $classname = 'Cotisation'; } - + // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { @@ -2936,7 +2936,7 @@ abstract class CommonObject return price2num($total_discount); } - + /** * Return into unit=0, the calculated total of weight and volume of all lines * qty * Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line. @@ -2951,13 +2951,13 @@ abstract class CommonObject $totalVolume = ''; $totalOrdered = ''; // defined for shipment only $totalToShip = ''; // defined for shipment only - + foreach ($this->lines as $line) { - + $totalOrdered+=$line->qty_asked; // defined for shipment only $totalToShip+=$line->qty_shipped; // defined for shipment only - + // Define qty, weight, volume, weight_units, volume_units if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments else $qty=$line->qty; @@ -2965,12 +2965,12 @@ abstract class CommonObject $volume=$line->volume; $weight_units=$line->weight_units; $volume_units=$line->volume_units; - + $weightUnit=0; $volumeUnit=0; if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($volume_units)) $volumeUnit = $volume_units; - + //var_dump($line->volume_units); if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) { @@ -2993,11 +2993,11 @@ abstract class CommonObject $totalVolume += $volume * $qty; // This may be wrong if we mix different units } } - + return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip); - } - - + } + + /** * Set extra parameters * @@ -3267,7 +3267,7 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print '
'; - + if ($inputalsopricewithtax) print ''; // Qty @@ -3430,7 +3430,7 @@ abstract class CommonObject $text.= ' - '.(! empty($line->label)?$line->label:$label); $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. } - + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) @@ -3871,7 +3871,7 @@ abstract class CommonObject return -1; } } - + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; @@ -3935,13 +3935,13 @@ abstract class CommonObject /* For default values */ /** - * Return the default value to use for a field when showing the create form of object. + * Return the default value to use for a field when showing the create form of object. * Return values in this order: * 1) If parameter is available into POST, we return it first. * 2) If not but an alternate value was provided as parameter of function, we return it. - * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). + * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). * 4) Return value found into database (TODO No yet implemented) - * + * * @param string $fieldname Name of field * @param string $alternatevalue Alternate value to use * @return string|string[] Default value (can be an array if the GETPOST return an array) @@ -3952,27 +3952,27 @@ abstract class CommonObject // If param here has been posted, we use this value first. if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2); - + if (isset($alternatevalue)) return $alternatevalue; - + $newelement=$this->element; if ($newelement == 'facture') $newelement='invoice'; if ($newelement == 'commande') $newelement='order'; - if (empty($newelement)) + if (empty($newelement)) { dol_syslog("Ask a default value using common method getDefaultCreateValueForField on an object with no property ->element defined. Return empty string.", LOG_WARNING); return ''; } - + $keyforfieldname=strtoupper($newelement.'_DEFAULT_'.$fieldname); //var_dump($keyforfieldname); if (isset($conf->global->$keyforfieldname)) return $conf->global->$keyforfieldname; - - // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname - + + // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname + } - - + + /* For triggers */ @@ -3989,7 +3989,7 @@ abstract class CommonObject function call_trigger($trigger_name, $user) { global $langs,$conf; - + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf); @@ -4171,7 +4171,7 @@ abstract class CommonObject { $res=$object->fetch(0,$value); if ($res > 0) $this->array_options[$key]=$object->id; - else + else { $this->error="Ref '".$value."' for object '".$object->element."' not found"; $this->db->rollback(); @@ -4235,7 +4235,7 @@ abstract class CommonObject } else return 0; } - + /** * Update an exta field value for the current object. * Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) @@ -4300,7 +4300,7 @@ abstract class CommonObject } break; } - + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key."='".$this->db->escape($this->array_options["options_".$key])."'"; $sql .= " WHERE fk_object = ".$this->id; @@ -4478,7 +4478,7 @@ abstract class CommonObject * @param int $origin_id Old thirdparty id (the thirdparty to delete) * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) * @param string[] $tables Tables that need to be changed - * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) + * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) * @return bool */ public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0) @@ -4487,7 +4487,7 @@ abstract class CommonObject { $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; - if (! $db->query($sql)) + if (! $db->query($sql)) { if ($ignoreerrors) return true; //$this->errors = $db->lasterror(); @@ -4497,26 +4497,26 @@ abstract class CommonObject return true; } - + /** * Get buy price to use for margin calculation. This function is called when buy price is unknown. * set buy price = sell price if ForceBuyingPriceIfNull configured, * else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice * else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice * else set min buy price as buy price - * + * * @param float $unitPrice product unit price * @param float $discountPercent line discount percent * @param int $fk_product product id * * @return float <0 if ko, buyprice if ok */ - public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) + public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) { global $conf; - + $buyPrice = 0; - + if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) // In most cases, test here is false { $buyPrice = $unitPrice * (1 - $discountPercent / 100); @@ -4560,7 +4560,7 @@ abstract class CommonObject $buyPrice = $product->pmp; } } - + if (empty($buyPrice) && isset($conf->global->MARGIN_TYPE) && in_array($conf->global->MARGIN_TYPE, array('1','pmp','costprice'))) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql index 5769d291563..8e69ca6331e 100644 --- a/htdocs/install/mysql/data/llx_accounting_category.sql +++ b/htdocs/install/mysql/data/llx_accounting_category.sql @@ -25,5 +25,5 @@ -- INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1); -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1); +INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1); INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1); \ No newline at end of file diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 307c88c3007..df0c64855b1 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -56,16 +56,12 @@ CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_fiscalyear FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingtransaction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 3611161b67353c96ac0ffbc9491c544deb48b19c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jun 2016 19:35:11 +0200 Subject: [PATCH 089/144] Fix custom code should not appears on services --- dev/translation/sanity_check_en_langfiles.php | 3 ++- htdocs/langs/en_US/products.lang | 2 ++ htdocs/product/card.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index f64798d72ff..6d63c415981 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -324,7 +324,8 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0; if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0; if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0; - + if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0; + if (preg_match('/sms/i', $value)) $qualifiedforclean=0; if (preg_match('/TF_/i', $value)) $qualifiedforclean=0; if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b1b8d601430..e9142d463ff 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -32,6 +32,8 @@ ServicesOnSellAndOnBuy=Services for sale and for purchase LastModifiedProductsAndServices=Latest %s modified products/services LastRecordedProducts=Latest %s recorded products LastRecordedServices=Latest %s recorded services +CardProduct0=Product card +CardProduct1=Service card Stock=Stock Stocks=Stocks Movements=Movements diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 330e712cf1b..e524b8f8303 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1314,7 +1314,7 @@ else } // Custom code - if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) + if (! $object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { print ''; // Origin country From 102179028c6db5db2ee3277ad6e04e0954389e1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 03:11:41 +0200 Subject: [PATCH 090/144] FIX #5414 --- htdocs/langs/en_US/admin.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index af3373bf4aa..d5086ca1343 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -564,6 +564,8 @@ Module59000Name=Margins Module59000Desc=Module to manage margins Module60000Name=Commissions Module60000Desc=Module to manage commissions +Module63000Name=Resources +Module63000Desc=Manage resources (printers, cars, room, ...) you can then share into events Permission11=Read customer invoices Permission12=Create/modify customer invoices Permission13=Unvalidate customer invoices From 62d7303d8fecd59dcaec7c4eb7da43b9e62c80cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 03:40:48 +0200 Subject: [PATCH 091/144] Add comment --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index aa36fa74624..71540cf16d7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4489,7 +4489,7 @@ abstract class CommonObject if (! $db->query($sql)) { - if ($ignoreerrors) return true; + if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. //$this->errors = $db->lasterror(); return false; } From 2c5e1c17fe4407cb2abae27fcc68900368569614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 03:42:19 +0200 Subject: [PATCH 092/144] Fix hard coded table prefix --- htdocs/societe/class/societe.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 0e7e375ac2f..e9b77836d3c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3483,17 +3483,17 @@ class Societe extends CommonObject * Because this function is meant to be executed within a transaction, we won't take care of it. */ $sql = 'SELECT rowid -FROM llx_societe_commerciaux +FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN ( SELECT fk_user - FROM llx_societe_commerciaux + FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE fk_soc = '.(int) $origin_id.' );'; $query = $db->query($sql); while ($result = $db->fetch_object($query)) { - $db->query('DELETE FROM llx_societe_commerciaux WHERE rowid = '.$result->rowid); + $db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.$result->rowid); } /** From 08fbc21bb16cfb7e1f7e33dd8d3abe8844044fa2 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 1 Jul 2016 08:36:20 +0200 Subject: [PATCH 093/144] llx_ecm_directories --- htdocs/install/pgsql/functions/functions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index d61976fbb36..3e976855bf0 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -95,7 +95,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directory FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 2520ee921aa604f647e62321e9b9de3f7a8b96fa Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 1 Jul 2016 08:37:24 +0200 Subject: [PATCH 094/144] llx_ecm_directories --- htdocs/install/pgsql/functions/functions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 46bb9223222..73961b04d0d 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -92,7 +92,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directory FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 09b824d819233f504aa587cb14fecafa02d7f38c Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 1 Jul 2016 16:44:05 +0200 Subject: [PATCH 095/144] FIX product stats all bloc module without enbaled test --- htdocs/product/stats/card.php | 55 +++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index d98d8ed31c6..b23cac67d9f 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -206,28 +206,39 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') } } - $graphfiles=array( - 'propal' =>array('modulepart'=>'productstats_proposals', - 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))), - 'proposalssuppliers'=>array('modulepart'=>'productstats_proposalssuppliers', - 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))), - - 'orders' =>array('modulepart'=>'productstats_orders', - 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))), - 'orderssuppliers'=>array('modulepart'=>'productstats_orderssuppliers', - 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders"):$langs->transnoentitiesnoconv("NumberOfSupplierOrders"))), - - 'invoices' =>array('modulepart'=>'productstats_invoices', - 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))), - 'invoicessuppliers'=>array('modulepart'=>'productstats_invoicessuppliers', - 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', - 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))), - ); + if($conf->propal->enabled) { + $graphfiles['propal']=array('modulepart'=>'productstats_proposals', + 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))); + } + + if($conf->supplier_proposal->enabled) { + $graphfiles['proposalssuppliers']=array('modulepart'=>'productstats_proposalssuppliers', + 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))); + } + + if($conf->order->enabled) { + $graphfiles['orders']=array('modulepart'=>'productstats_orders', + 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))); + } + + if($conf->fournisseur->enabled) { + $graphfiles['orderssuppliers']=array('modulepart'=>'productstats_orderssuppliers', + 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders"):$langs->transnoentitiesnoconv("NumberOfSupplierOrders"))); + } + + if($conf->facture->enabled) { + $graphfiles['invoices']=array('modulepart'=>'productstats_invoices', + 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))); + + $graphfiles['invoicessuppliers']=array('modulepart'=>'productstats_invoicessuppliers', + 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', + 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))); + } $px = new DolGraph(); From cf5de9d0c878a3f35f9fd47ce6f4a0f28c15a5c2 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 1 Jul 2016 16:59:03 +0200 Subject: [PATCH 096/144] FIX form_confirm to delete payment on supplier invoice --- htdocs/fourn/facture/card.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 38dcdc87759..1a7d236307b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -292,14 +292,17 @@ if (empty($reshook)) } // Delete payment - elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) + elseif ($action == 'confirm_delete_paiement' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { - $object->fetch($id); + $object->fetch($id); if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) { $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); - if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found + if ($result > 0) { + $result=$paiementfourn->delete(); // If fetch ok and found + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + } if ($result < 0) { setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors'); } @@ -1725,6 +1728,12 @@ else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); + } + if ($action == 'deletepaiement') + { + $payment_id = GETPOST('paiement_id'); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1); + } // Confirmation to delete line From e55750250487f140dd76d30a5de410bad1a4b26c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 17:34:49 +0200 Subject: [PATCH 097/144] Fix save of stock limit failed --- htdocs/product/stock/product.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index d8051465626..9bc37ad5a7a 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -50,7 +50,7 @@ $cancel=GETPOST('cancel'); $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); -$stocklimit = GETPOST('stocklimit'); +$stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; @@ -70,7 +70,7 @@ $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldi if ($cancel) $action=''; // Set stock limit -if ($action == 'setstocklimit') +if ($action == 'setseuil_stock_alerte') { $object = new Product($db); $result=$object->fetch($id); @@ -78,6 +78,8 @@ if ($action == 'setstocklimit') $result=$object->update($object->id,$user,0,'update'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + //else + // setEventMessage($lans->trans("SavedRecordSuccessfully")); $action=''; } From 59f86a12d216a007419eba0a0c0f8f3c65378ca6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 17:49:13 +0200 Subject: [PATCH 098/144] Fix delete of documents generated on project. Fix missin translation --- htdocs/commande/card.php | 4 ++-- htdocs/core/class/html.formprojet.class.php | 6 ++++-- .../project/doc/pdf_beluga.modules.php | 4 ++-- htdocs/projet/card.php | 20 ++++++++++--------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e67b18a5989..f3240443a6e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1195,9 +1195,9 @@ if (empty($reshook)) $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) - setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); else - setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); $action = ''; } } diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index f160e4cd500..d2ad0a6f1ab 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -464,12 +464,14 @@ class FormProjets $sql = "SELECT t.id as rowid, t.label as ref"; $projectkey="fk_project"; break; - case "expensereport_det": + case "expensereport": return ''; + case "expensereport_det": /*$sql = "SELECT rowid, '' as ref"; // table is llx_expensereport_det $projectkey="fk_projet"; break;*/ - case "commande": + return ''; + case "commande": case "contrat": case "fichinter": $sql = "SELECT t.rowid, t.ref"; diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 37c228607e1..2b58cd59c09 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -294,7 +294,7 @@ class pdf_beluga extends ModelePDFProjects 'lang'=>'interventions'), 'trip'=>array( 'name'=>"TripsAndExpenses", - 'title'=>"ListTripAssociatedProject", + 'title'=>"ListExpenseReportsAssociatedProject", 'class'=>'Deplacement', 'table'=>'deplacement', 'datefieldname'=>'dated', @@ -304,7 +304,7 @@ class pdf_beluga extends ModelePDFProjects 'lang'=>'trip'), 'expensereport'=>array( 'name'=>"ExpensesReports", - 'title'=>"ListTripAssociatedProject", + 'title'=>"ListExpenseReportsAssociatedProject", 'class'=>'ExpenseReport', 'table'=>'expensereport', 'datefieldname'=>'dated', diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ed3311a1b30..d3895b0000e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -307,17 +307,19 @@ if (empty($reshook)) // Delete file in doc form if ($action == 'remove_file' && $user->rights->projet->creer) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - if ($object->id > 0) { - $langs->load("other"); - $upload_dir = $conf->projet->dir_output . "/"; - $urlfile=GETPOST('urlfile','alpha'); - $file = $upload_dir . '/' . $filetodelete; - $ret=dol_delete_file($file); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $conf->projet->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret = dol_delete_file($file, 0, 0, 0, $object); + if ($ret) + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); + $action = ''; } } From 0e7889a68c0d5d97cb6862bab201704f0847ac2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 17:53:16 +0200 Subject: [PATCH 099/144] Fix must show label of leave type and not id. --- htdocs/holiday/view_log.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index a9fe469c0cf..e4b5070f097 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -50,6 +50,8 @@ $langs->load('users'); $cp = new Holiday($db); +$alltypeleaves=$cp->getTypes(1,-1); // To have labels + llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')'); // Recent changes are more important than old changes @@ -94,7 +96,10 @@ foreach($cp->logs as $logs_CP) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''."\n"; From 02e35f8c76c66e84569288bf476412b1ba465702 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 18:12:37 +0200 Subject: [PATCH 100/144] Fix where is the clone of intervention ? --- htdocs/fichinter/card.php | 49 +++++++++++ htdocs/fichinter/class/fichinter.class.php | 98 +++++++++++++++++++++- htdocs/langs/en_US/interventions.lang | 2 + 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 567c60408e7..e05b1cde1a4 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -111,6 +111,36 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + // Action clone object + if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->ficheinter->creer) + { + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); + } + else + { + if ($object->id > 0) + { + // Because createFromClone modifies the object, we must clone it so that we can restore it later + $orig = clone $object; + + $result=$object->createFromClone($socid); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $object = $orig; + $action=''; + } + } + } + } + if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer) { $result = $object->setValid($user); @@ -1094,6 +1124,20 @@ else if ($id > 0 || ! empty($ref)) $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$lineid, $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => + // 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' + // => 1), + array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '', '', 0, 0, null, 0, 'minwidth200'))); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneIntervention'), $langs->trans('ConfirmCloneIntervention', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + if (!$formconfirm) { $parameters=array('lineid'=>$lineid); @@ -1588,6 +1632,11 @@ else if ($id > 0 || ! empty($ref)) } } + // Clone + if ($user->rights->ficheinter->creer) { + print ''; + } + // Delete if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 66fb1031d6e..4f86be24205 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -220,7 +220,6 @@ class Fichinter extends CommonObject if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); if ($result < 0) { @@ -926,6 +925,103 @@ class Fichinter extends CommonObject return -2; } + + + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @return int New id of clone + */ + function createFromClone($socid=0) + { + global $user,$hookmanager; + + $error=0; + + $this->context['createfromclone'] = 'createfromclone'; + + $this->db->begin(); + + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + + // Load source object + $objFrom = clone $this; + + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) + { + $objsoc = new Societe($this->db); + + if ($objsoc->fetch($socid)>0) + { + $this->socid = $objsoc->id; + $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = ''; + $this->fk_delivery_address = ''; + } + + // TODO Change product price if multi-prices + } + + $this->id=0; + $this->ref = ''; + $this->statut=0; + + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date_creation = ''; + $this->date_validation = ''; + $this->ref_client = ''; + + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // Add lines because it is not included into create function + foreach ($this->lines as $line) + { + // TODO + + } + + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + + // Call trigger + $result=$this->call_trigger('INTERVENTION_CLONE',$user); + if ($result < 0) $error++; + // End call triggers + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } + + /** * Adding a line of intervention into data base * diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 26959e39ab9..b0adb985dff 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -14,10 +14,12 @@ DeleteIntervention=Delete intervention ValidateIntervention=Validate intervention ModifyIntervention=Modify intervention DeleteInterventionLine=Delete intervention line +CloneIntervention=Clone intervention ConfirmDeleteIntervention=Are you sure you want to delete this intervention ? ConfirmValidateIntervention=Are you sure you want to validate this intervention under name %s ? ConfirmModifyIntervention=Are you sure you want to modify this intervention ? ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention line ? +ConfirmCloneIntervention=Are you sure you want to clone this intervention ? NameAndSignatureOfInternalContact=Name and signature of intervening : NameAndSignatureOfExternalContact=Name and signature of customer : DocumentModelStandard=Standard document model for interventions From c8c51dd96dd47ff24b98029369dfb337189e6643 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 19:15:30 +0200 Subject: [PATCH 101/144] Fix clone of intervention was not cloning lines. --- htdocs/fichinter/class/fichinter.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 4f86be24205..54d5dc05c33 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -958,8 +958,8 @@ class Fichinter extends CommonObject if ($objsoc->fetch($socid)>0) { $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + //$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + //$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $this->fk_project = ''; $this->fk_delivery_address = ''; } @@ -987,8 +987,7 @@ class Fichinter extends CommonObject // Add lines because it is not included into create function foreach ($this->lines as $line) { - // TODO - + $this->addline($user, $this->id, $line->desc, $line->datei, $line->duration); } // Hook of thirdparty module @@ -1132,9 +1131,11 @@ class Fichinter extends CommonObject $line = new FichinterLigne($this->db); $line->id = $objp->rowid; $line->desc = $objp->description; + $line->duration = $objp->duree; //For invoicing we calculing hours $line->qty = round($objp->duree/3600,2); $line->date = $this->db->jdate($objp->date); + $line->datei = $this->db->jdate($objp->date); $line->rang = $objp->rang; $line->product_type = 1; From 0639bafa6bf354d786ecac7fc3b876db32b940cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Jul 2016 10:19:38 +0200 Subject: [PATCH 102/144] Update list.php --- htdocs/fourn/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 9f99df55add..89060d9f913 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -174,7 +174,7 @@ if (GETPOST('statut', 'alpha') !== '') $sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")"; } -if ($billed !== '') +if ($billed !== '' && $billed >= 0) { $sql .= " AND cf.billed = ".$billed; } @@ -215,7 +215,7 @@ if ($resql) if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; if ($socid) $param.="&socid=".$socid; if ($search_status >= 0) $param.="&search_status=".$search_status; - if ($billed != '') $param.="billed=".$billed; + if ($billed != '') $param.="&billed=".$billed; if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); From 91d2d573c315dcfd99afa4e4d3a32520dcff3179 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 11:26:55 +0200 Subject: [PATCH 103/144] Fix NNE has been replaced with ICS --- htdocs/admin/prelevement.php | 43 ++++++++----------- .../class/bonprelevement.class.php | 11 ++--- htdocs/core/lib/prelevement.lib.php | 4 +- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 410851b640b..b131009ab88 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -45,14 +45,6 @@ $action = GETPOST('action','alpha'); if ($action == "set") { $db->begin(); - for ($i = 0 ; $i < 2 ; $i++) - { - $res = dolibarr_set_const($db, GETPOST("nom$i",'alpha'), GETPOST("value$i",'alpha'),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - } - - $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); $account = new Account($db); @@ -78,6 +70,15 @@ if ($action == "set") } else $error++; + $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + + if (GETPOST("PRELEVEMENT_USER") > 0) + { + $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + if (! $error) { $db->commit(); @@ -131,33 +132,25 @@ print ''; print ''; print ""; -//User -print ''; -print ''; -print ''; - -//Profid1 of Transmitter -print ''; -print ''; -print ''; - // Bank account (from Banks module) -print ''; +print ''; print ''; // ICS -print ''; +print ''; print ''; print ''; +//User +print ''; +print ''; +print ''; + print '
'.$langs->trans('Payments').''.$langs->trans('Date').'
'.$langs->trans("Ref").''; -if ($_GET["account"]) +if (!empty($id)) { if (! preg_match('/,/', $id)) { From 75bb16193089d141c71a96d0db24fb95364545ec Mon Sep 17 00:00:00 2001 From: atm-geoffrey Date: Thu, 30 Jun 2016 16:20:53 +0200 Subject: [PATCH 080/144] FIX #4828 --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 123189bdc87..a78eac54695 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -781,7 +781,7 @@ if ($action == 'create') print '
'.$langs->trans("Project").''; - $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); + $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); if ($numproject==0) { print '   '.$langs->trans("AddProject").''; From aa67a29115817036fcc9016b0641f7f984e82202 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 16:40:38 +0200 Subject: [PATCH 081/144] FIX #4383 $userid not defined --- htdocs/user/class/userbankaccount.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 30c795bbd72..437be45c7b2 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -142,8 +142,7 @@ class UserBankAccount extends Account $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; $sql.= " owner_address, label, datec, tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rib"; - if ($id) $sql.= " WHERE rowid = ".$id; - if ($socid) $sql.= " WHERE fk_user = ".$userid; + $sql.= " WHERE rowid = ".$id; $resql = $this->db->query($sql); if ($resql) From 388bd5ca4830375c5c9c8a38941477eceac8da0c Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 30 Jun 2016 16:42:49 +0200 Subject: [PATCH 082/144] code review --- htdocs/comm/remx.php | 45 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index a4aff6d71c1..b682b214da8 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -32,6 +32,8 @@ $langs->load("orders"); $langs->load("bills"); $langs->load("companies"); +$id=GETPOST('id','int'); + $action=GETPOST('action','alpha'); $backtopage=GETPOST('backtopage','alpha'); @@ -58,6 +60,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) + $amount_ttc_1=GETPOST('amount_ttc_1'); + $amount_ttc_2=GETPOST('amount_ttc_2'); + $error=0; $remid=GETPOST("remid")?GETPOST("remid"):0; $discount=new DiscountAbsolute($db); @@ -67,7 +72,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $error++; setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors'); } - if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc) + if (! $error && price2num($amount_ttc_1+$amount_ttc_2) != $discount->amount_ttc) { $error++; setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors'); @@ -120,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') if ($res > 0 && $newid1 > 0 && $newid2 > 0) { $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"].'?id='.$_REQUEST['id']); // To avoid pb whith back + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back exit; } else @@ -135,10 +140,14 @@ if ($action == 'setremise') //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) - if (price2num($_POST["amount_ht"]) > 0) + $amount_ht=GETPOST('amount_ht'); + $desc=GETPOST('desc','alpha'); + $tva_tx=GETPOST('tva_tx','alpha'); + + if (price2num($amount_ht) > 0) { $error=0; - if (empty($_POST["desc"])) + if (empty($desc)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); $error++; @@ -147,8 +156,8 @@ if ($action == 'setremise') if (! $error) { $soc = new Societe($db); - $soc->fetch($_GET["id"]); - $discountid=$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); + $soc->fetch($id); + $discountid=$soc->set_remise_except($amount_ht,$user,$desc,$tva_tx); if ($discountid > 0) { @@ -159,7 +168,7 @@ if ($action == 'setremise') } else { - header("Location: remx.php?id=".$_GET["id"]); + header("Location: remx.php?id=".$id); exit; } } @@ -189,7 +198,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes') if ($result > 0) { $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"].'?id='.GETPOST('id','int')); // To avoid pb whith back + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back exit; } else @@ -227,11 +236,11 @@ if ($socid > 0) print ''; dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company'); - + dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; - + print '
'; print ''; @@ -264,22 +273,22 @@ if ($socid > 0) print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); print '
'; - print ''; + print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "
'.$langs->trans("AmountHT").'
'.$langs->trans("AmountHT").''; print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); print '
'.$langs->trans("NoteReason").'
'.$langs->trans("NoteReason").'
"; print '
'; - + dol_fiche_end(); - + print '
'; print ''; if (! empty($backtopage)) @@ -296,7 +305,7 @@ if ($socid > 0) if ($_GET['action'] == 'remove') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.GETPOST('remid'), $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); } /* @@ -383,7 +392,7 @@ if ($socid > 0) else print '
 
'.$langs->trans('PriceUHTCurrency').''.$langs->trans('PriceUTTC').'
'.$langs->trans("CustomCode").''.$user_action->getNomUrl(1).''.$user_update->getNomUrl(1).''.$logs_CP['type_action'].''.$logs_CP['fk_type'].''; + $label=$alltypeleaves[$logs_CP['fk_type']]['label']; + print $label?$label:$logs_CP['fk_type']; + print ''.price2num($logs_CP['prev_solde'],5).' '.$langs->trans('days').''.price2num($logs_CP['new_solde'],5).' '.$langs->trans('days').'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ResponsibleUser").''; -print ''; -print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'value0', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); -print '
'.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->country_code).''; -print ''; -print '
'.$langs->trans("BankToReceiveWithdraw").'
'.$langs->trans("BankToReceiveWithdraw").''; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); print '
'.$langs->trans("ICS").'
'.$langs->trans("ICS").''; print '
'.$langs->trans("ResponsibleUser").''; +print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print '
'; print '
'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 31d9e4d67c1..a318673e1c8 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -87,8 +87,6 @@ class BonPrelevement extends CommonObject $this->factures = array(); - $this->numero_national_emetteur = ""; - $this->methodes_trans = array(); $this->methodes_trans[0] = "Internet"; @@ -1018,7 +1016,6 @@ class BonPrelevement extends CommonObject $this->date_echeance = $datetimeprev; $this->reference_remise = $ref; - $this->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR; $this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE; $this->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE; @@ -1027,7 +1024,7 @@ class BonPrelevement extends CommonObject $this->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY; $this->emetteur_iban = $conf->global->PRELEVEMENT_IBAN; $this->emetteur_bic = $conf->global->PRELEVEMENT_BIC; - $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // TODO Add this into setup of admin/prelevement.php. Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; + $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; $this->factures = $factures_prev_id; @@ -1462,7 +1459,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1611,7 +1608,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1778,7 +1775,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Reserve C1 diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index a575ae51bcc..47bc2cb1974 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -78,9 +78,9 @@ function prelevement_prepare_head(BonPrelevement $object) function prelevement_check_config() { global $conf; - if(empty($conf->global->PRELEVEMENT_USER)) return -1; if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1; - if(empty($conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR)) return -1; + if(empty($conf->global->PRELEVEMENT_ICS)) return -1; + if(empty($conf->global->PRELEVEMENT_USER)) return -1; return 0; } From 3eaf0bc4bfcb0944bce839c559eea9e6585c9379 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 11:32:06 +0200 Subject: [PATCH 104/144] Fix bad translation --- htdocs/core/modules/modSupplierProposal.class.php | 2 +- htdocs/langs/en_US/supplier_proposal.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 9c249da4dc6..3ca6b534506 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -141,7 +141,7 @@ class modSupplierProposal extends DolibarrModules $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=commercial', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry - 'titre'=>'SupplierProposalShort', + 'titre'=>'SupplierProposalsShort', 'leftmenu'=>'supplier_proposalsubmenu', 'url'=>'/supplier_proposal/index.php', 'langs'=>'supplier_proposal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index 86127b11a96..909a4d713c1 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -12,6 +12,7 @@ RequestsOpened=Open price requests SupplierProposalArea=Supplier proposals area SupplierProposalShort=Supplier proposal SupplierProposals=Supplier proposals +SupplierProposalsShort=Supplier proposals NewAskPrice=New price request ShowSupplierProposal=Show price request AddSupplierProposal=Create a price request From 7d9671f6d3c8f0f546bb28efd0e4395a73b1f10d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 11:44:46 +0200 Subject: [PATCH 105/144] Fix bad separator in url --- htdocs/core/modules/modSupplierProposal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 3ca6b534506..842146597a3 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -156,7 +156,7 @@ class modSupplierProposal extends DolibarrModules 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', 'titre'=>'SupplierProposalNew', - 'url'=>'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', + 'url'=>'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'langs'=>'supplier_proposal', 'enabled'=>'$conf->supplier_proposal->enabled', 'perms'=>'$user->rights->supplier_proposal->creer', @@ -182,7 +182,7 @@ class modSupplierProposal extends DolibarrModules 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', 'titre'=>'Statistics', - 'url'=>'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', + 'url'=>'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'langs'=>'supplier_proposal', 'enabled'=>'$conf->supplier_proposal->enabled', 'perms'=>'$user->rights->supplier_proposal->lire', From 525b2cf2971c814d2154dbba676c2974ff3417c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 12:02:51 +0200 Subject: [PATCH 106/144] Fix: Edition of contract on intervention failed --- htdocs/core/class/html.formcontract.class.php | 30 ++++++++++++++++++- htdocs/fichinter/card.php | 14 ++------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 0169f5ae811..80b618b8804 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -50,7 +50,7 @@ class FormContract * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @param int $showempty Show empty line - * @return int Nbre of project if OK, <0 if KO + * @return int Nbr of project if OK, <0 if KO */ function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) { @@ -137,4 +137,32 @@ class FormContract return -1; } } + + /** + * Show a form to select a contract + * + * @param int $page Page + * @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id) + * @param int $selected Id contract preselected + * @param string $htmlname Nom de la zone html + * @param int $maxlength Maximum length of label + * @param int $showempty Show empty line + * @return int Nbr of project if OK, <0 if KO + */ + function formSelectContract($page, $socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) + { + global $langs; + + print "\n"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty); + print '
'; + } + } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index e05b1cde1a4..2a4ec4337f2 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -477,7 +477,7 @@ if (empty($reshook)) } // Set into a contract - else if ($action == 'setcontrat' && $user->rights->contrat->creer) + else if ($action == 'setcontract' && $user->rights->contrat->creer) { $result=$object->set_contrat($user,GETPOST('contratid','int')); if ($result < 0) dol_print_error($db,$object->error); @@ -1251,15 +1251,8 @@ else if ($id > 0 || ! empty($ref)) print ''; if ($action == 'contrat') { - print ''; - print ''; - print ''; - print '
'; - $htmlcontract= new Formcontract($db); - //print "$socid,$selected,$htmlname"; - $htmlcontract->select_contract($object->socid,$object->fk_contrat,'contratid'); - - print '
'; + $formcontract= new Formcontract($db); + $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); } else { @@ -1649,7 +1642,6 @@ else if ($id > 0 || ! empty($ref)) } print ''; - print '
'; if ($action != 'presend') { From 9a75d40d56f423f4452bdc3f3b7bd253c9659224 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 12:21:47 +0200 Subject: [PATCH 107/144] Fix switching between web sites --- htdocs/websites/index.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index ae29dab196b..19f72486c3f 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -137,6 +137,8 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain * Actions */ +if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid. + // Add page if ($action == 'add') { @@ -321,7 +323,7 @@ if ($action == 'updatemeta') $res = $objectpage->fetch($pageid, $object->fk_website); if ($res > 0) { - $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); + $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); $objectpage->title = GETPOST('WEBSITE_TITLE'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS'); @@ -476,7 +478,7 @@ if (count($object->records) > 0) } $out.=''; print $out; - print ''; + print ''; if ($website) { @@ -529,22 +531,31 @@ if (count($object->records) > 0) $out.=''; print $out; - print ''; + print ''; print ''; //print $form->selectarray('page', $array); From fe86ef57747ec3b61b27c6affae6ab179ca1b2a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 17:00:45 +0200 Subject: [PATCH 108/144] Thirdparty into keyword, encoded with convToOutputCharset --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 2 +- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index aff994a5209..98091a8b727 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -239,7 +239,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetSubject($outputlangs->transnoentities("Order")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 1aabe54cbd8..a2828fb466a 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -198,7 +198,7 @@ class pdf_strato extends ModelePDFContract $pdf->SetSubject($outputlangs->transnoentities("ContractCard")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 4305f379f44..1b36ef6c92f 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -282,7 +282,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetSubject($outputlangs->transnoentities("Invoice")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 81f73b98f29..801d6dc16e4 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -296,7 +296,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetSubject($outputlangs->transnoentities("CommercialProposal")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 2787f446e4e..ceed17350d0 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -232,7 +232,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetSubject($outputlangs->transnoentities("Invoice")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 783a0b2d0b6..d8912fa1a42 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -243,7 +243,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetSubject($outputlangs->transnoentities("Order")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 797aa81ce4b..2a6a442582c 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -252,7 +252,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetSubject($outputlangs->transnoentities("CommercialAsk")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right From 3d72f788b95883da02ae3bb4b89a6ce10d385109 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 18:02:39 +0200 Subject: [PATCH 109/144] Fix phpcs --- htdocs/core/modules/mailings/advthirdparties.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 1e04fe5459d..24ad5ee4a0b 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -200,9 +200,10 @@ class mailing_advthirdparties extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @return int Nb of recipients + * @param string $sql Sql request to use + * @return int Nb of recipients */ - function getNbOfRecipients($sql) + function getNbOfRecipients($sql='') { global $conf; From a8b1699abbec48568720e33ffac79dee44c33865 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Sat, 2 Jul 2016 18:26:31 +0000 Subject: [PATCH 110/144] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/accountancy/class/accountancycategory.class.php | 2 +- htdocs/core/boxes/box_actions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 43b9816c5ed..6211f5752b1 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -297,7 +297,7 @@ class AccountancyCategory * @param string $year Specific year * @param int $sens Sens of the account 0: credit - debit 1: debit - credit * - * @return array Result in table + * @return integer Result in table */ public function getResult($cpt, $month, $year, $sens) { $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 82aacf2d8a0..973738fec11 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -168,7 +168,7 @@ class box_actions extends ModeleBoxes * @param array $head Array with properties of box title * @param array $contents Array with properties of box lines * @param int $nooutput No print, only return string - * @return void + * @return string */ function showBox($head = null, $contents = null, $nooutput=0) { From ce3f45c2a270a5319713a12031488baf95ce4797 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 13:14:33 +0200 Subject: [PATCH 111/144] Debug of doliwamp for 4.0 --- build/exe/doliwamp/dolibarr.conf.install | 17 +++++++-- build/exe/doliwamp/doliwamp.iss | 34 ++++------------- build/exe/doliwamp/httpd.conf.install | 38 ++++++++++--------- .../exe/doliwamp/install_services.bat.install | 8 +++- build/exe/doliwamp/phpmyadmin.conf.install | 31 ++++++++++----- .../doliwamp/uninstall_services.bat.install | 11 +++++- dev/security/htaccess.txt | 3 +- 7 files changed, 80 insertions(+), 62 deletions(-) diff --git a/build/exe/doliwamp/dolibarr.conf.install b/build/exe/doliwamp/dolibarr.conf.install index 40b8dea7784..4dbb8c62317 100644 --- a/build/exe/doliwamp/dolibarr.conf.install +++ b/build/exe/doliwamp/dolibarr.conf.install @@ -1,6 +1,6 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" -# NOTE: +# NOTE FOR APACHE 2.2: # To restrict access to dolibarr from outside set lines # # Order Deny,Allow @@ -12,10 +12,21 @@ Alias /dolibarr "WAMPROOT/www/dolibarr/htdocs/" # Order Allow,Deny # Allow from all # +# NOTE FOR APACHE 2.3: +# To restrict access to dolibarr from outside set lines +# +# +# Require ip 127.0.0.1 +# Require host localhost +# +# +# instead of +# +# Require all granted +# Options Indexes FollowSymLinks MultiViews AllowOverride all - Order Allow,Deny - Allow from all + Require all granted \ No newline at end of file diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index e4cfc326422..3aaf113e679 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -101,7 +101,7 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi ; Put here path of Wampserver applications ; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 or 5.1.36 ; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36 -; Value ???: apache 2.4.19, php 5.5.12, mysql 5.6.17 +; Value ???: apache 2.4.19, php 5.5.12, mysql 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange" Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" @@ -119,8 +119,8 @@ Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Fl Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion; Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion; Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; -Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.5.12"; Flags: ignoreversion; -Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.6.17"; Flags: ignoreversion; +Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion; +Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion; Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion; Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; @@ -338,11 +338,11 @@ begin // Test if VC11Redist has been installed //---------------------------------------------- - if not FileExists ('c:/windows/system32/msvcr70.dll') and not FileExists ('c:/windows/sysWOW64/msvcr70.dll') and not FileExists ('c:/winnt/system32/msvcr70.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr70.dll') then + if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then begin // TODO Copy file or ask to install package ? //CustomMessage('YouWillInstallDoliWamp')+#13#13 - MsgBox('The package vcredist_x64.exe or vcredist_86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); + MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); end; @@ -749,6 +749,7 @@ begin LoadStringFromFile (srcFile, srcContents); //version de apache et mysql + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); @@ -757,27 +758,6 @@ begin - //---------------------------------------------- - // Create file install_services_auto.bat (always) - //---------------------------------------------- - - destFile := pathWithSlashes+'/install_services_auto.bat'; - srcFile := pathWithSlashes+'/install_services_auto.bat.install'; - - if FileExists (srcFile) then - begin - LoadStringFromFile (srcFile, srcContents); - - //version de apache et mysql - StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); - StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); - - SaveStringToFile(destFile,srcContents, False); - end - - - - //---------------------------------------------- // Create file uninstall_services.bat (always) //---------------------------------------------- @@ -790,6 +770,7 @@ begin LoadStringFromFile (srcFile, srcContents); //version de apache et mysql + StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True); @@ -978,7 +959,6 @@ end; procedure DeinitializeSetup(); begin // DeleteFile(path+'\install_services.bat'); -// DeleteFile(path+'\install_services_auto.bat'); end; diff --git a/build/exe/doliwamp/httpd.conf.install b/build/exe/doliwamp/httpd.conf.install index bfe17b07d42..6519fdd7795 100644 --- a/build/exe/doliwamp/httpd.conf.install +++ b/build/exe/doliwamp/httpd.conf.install @@ -66,19 +66,24 @@ Listen WAMPAPACHEPORT # LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so +LoadModule allowmethods_module modules/mod_allowmethods.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so -LoadModule authn_default_module modules/mod_authn_default.so +#LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_file_module modules/mod_authn_file.so +LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so -LoadModule authz_default_module modules/mod_authz_default.so +#LoadModule authz_default_module modules/mod_authz_default.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so +LoadModule buffer_module modules/mod_buffer.so +LoadModule cache_module modules/mod_cache.so +LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule cgi_module modules/mod_cgi.so #LoadModule dav_module modules/mod_dav.so @@ -96,23 +101,23 @@ LoadModule isapi_module modules/mod_isapi.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so #LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule negotiation_module modules/mod_negotiation.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so -LoadModule negotiation_module modules/mod_negotiation.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule speling_module modules/mod_speling.so +#LoadModule ssl_module modules/mod_ssl.so LoadModule status_module modules/mod_status.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule userdir_module modules/mod_userdir.so #LoadModule usertrack_module modules/mod_usertrack.so LoadModule vhost_alias_module modules/mod_vhost_alias.so -#LoadModule ssl_module modules/mod_ssl.so -LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_2.dll" +LoadModule php5_module "WAMPROOT/bin/php/phpWAMPPHPVERSION/php5apache2_4.dll" # # ExtendedStatus controls whether Apache will generate "full" status @@ -123,9 +128,9 @@ ExtendedStatus On SetHandler server-status -Order Deny,Allow -Deny from all -Allow from localhost, 127.0.0.1 +Require local +#Require ip 1.2.3.4 +#Require host 1.2.3.4 @@ -211,9 +216,7 @@ KeepAliveTimeout 30 Options FollowSymLinks AllowOverride None - Order deny,allow - Deny from all - Satisfy all + Require all denied # @@ -253,9 +256,10 @@ KeepAliveTimeout 30 # Controls who can get stuff from this server. # # onlineoffline tag - don't remove - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + + Require ip 127.0.0.1 + Require host localhost + @@ -272,8 +276,7 @@ KeepAliveTimeout 30 # viewed by Web clients. # - Order allow,deny - Deny from all + Require all denied # @@ -359,8 +362,7 @@ LogLevel warn AllowOverride None Options None - Order allow,deny - Allow from all + Require all granted # diff --git a/build/exe/doliwamp/install_services.bat.install b/build/exe/doliwamp/install_services.bat.install index 991e6f040aa..536a984e26d 100644 --- a/build/exe/doliwamp/install_services.bat.install +++ b/build/exe/doliwamp/install_services.bat.install @@ -8,14 +8,18 @@ echo ---- Execute install_services.bat >> doliwamp.log 2>>&1 REM NET STOP doliwampapache REM NET STOP doliwampmysqld +cd "WAMPROOT" + REM Apache x.x .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k install -n doliwampapache REM reg add HKLM\SYSTEM\CurrentControlSet\Services\doliwampapache /V Start /t REG_DWORD /d 3 /f REM Mysql 5.0- REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --install-manual doliwampmysqld -.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --install doliwampmysqld +REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --install doliwampmysqld REM Mysql 5.1+ -REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld +.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld echo ---- End script >> doliwamp.log 2>>&1 + +REM pause diff --git a/build/exe/doliwamp/phpmyadmin.conf.install b/build/exe/doliwamp/phpmyadmin.conf.install index ff7045835fa..533a5289433 100644 --- a/build/exe/doliwamp/phpmyadmin.conf.install +++ b/build/exe/doliwamp/phpmyadmin.conf.install @@ -1,22 +1,35 @@ Alias /phpmyadmin "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/" -# to give access to phpmyadmin from outside -# replace the lines +# NOTE FOR APACHE 2.2: +# To grant access to dolibarr from outside set lines # -# Order Deny,Allow +# Order Allow,Deny +# Allow from all +# +# instead of +# +# Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # -# by +# NOTE FOR APACHE 2.3: +# To grant access to dolibarr from outside set lines # -# Order Allow,Deny -# Allow from all +# Require all granted +# +# instead of +# +# +# Require ip 127.0.0.1 +# Require host localhost +# # Options Indexes FollowSymLinks MultiViews AllowOverride all - Order Deny,Allow - Deny from all - Allow from 127.0.0.1 + + Require ip 127.0.0.1 + Require host localhost + \ No newline at end of file diff --git a/build/exe/doliwamp/uninstall_services.bat.install b/build/exe/doliwamp/uninstall_services.bat.install index 52b166c19d4..b8aa5027b01 100644 --- a/build/exe/doliwamp/uninstall_services.bat.install +++ b/build/exe/doliwamp/uninstall_services.bat.install @@ -3,10 +3,19 @@ REM -------------------------------------------------------- REM This script install Apache and Mysql DoliWamp services REM -------------------------------------------------------- +cd "WAMPROOT" + echo ---- Execute uninstall_services.bat >> doliwamp.log 2>>&1 NET STOP doliwampapache .\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -k uninstall -n doliwampapache + NET STOP doliwampmysqld -.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld +REM Mysql 5.0- +REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld +REM Mysql 5.1+ +.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --remove doliwampmysqld + REM wampmanager.exe -quit -id={doliwampserver} echo ---- End script >> doliwamp.log 2>>&1 + +REM pause diff --git a/dev/security/htaccess.txt b/dev/security/htaccess.txt index 7d3aaf1a903..a8364c85a0f 100644 --- a/dev/security/htaccess.txt +++ b/dev/security/htaccess.txt @@ -1,2 +1 @@ -Order allow,deny -Deny from all \ No newline at end of file +Require all granted From f3eb564d5f6b79a059299f361d412dd76ba6b0f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 15:24:01 +0200 Subject: [PATCH 112/144] Some fix for mysql5.6.17 --- build/exe/doliwamp/doliwamp.iss | 2 +- build/exe/doliwamp/httpd.conf.install | 3 +- build/exe/doliwamp/my.ini.install | 60 ------------------- build/exe/doliwamp/startdoliwamp.bat | 6 +- .../startdoliwamp_manual_donotuse.bat.install | 3 +- build/exe/doliwamp/stopdoliwamp.bat | 4 +- 6 files changed, 11 insertions(+), 67 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 3aaf113e679..cc5235b58c2 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -675,7 +675,7 @@ begin //installDir et version de php StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True); StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True); - StringChangeEx (srcContents, 'WAMPMYSQLVERSION', myport, True); + StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True); SaveStringToFile(destFile,srcContents, False); end diff --git a/build/exe/doliwamp/httpd.conf.install b/build/exe/doliwamp/httpd.conf.install index 6519fdd7795..96bf688b1d5 100644 --- a/build/exe/doliwamp/httpd.conf.install +++ b/build/exe/doliwamp/httpd.conf.install @@ -72,7 +72,6 @@ LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so -#LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so @@ -412,7 +411,7 @@ LogLevel warn # keep browsers from trying to display binary files as though they are # text. # -DefaultType text/plain +#DefaultType text/plain # diff --git a/build/exe/doliwamp/my.ini.install b/build/exe/doliwamp/my.ini.install index c855cc27a66..885660f648b 100644 --- a/build/exe/doliwamp/my.ini.install +++ b/build/exe/doliwamp/my.ini.install @@ -77,10 +77,6 @@ log-error=WAMPROOT/logs/mysql.log #Path to the database root datadir=WAMPROOT/bin/mysql/data -# The default character set that will be used when a new schema or table is -# created and no character set is defined -default-character-set=latin1 - # The default storage engine that will be used when create new tables when default-storage-engine=INNODB @@ -101,13 +97,6 @@ max_connections=255 # slowdown instead of a performance improvement. query_cache_size=8M -# The number of open tables for all threads. Increasing this value -# increases the number of file descriptors that mysqld requires. -# Therefore you have to make sure to set the amount of open files -# allowed to at least 4096 in the variable "open-files-limit" in -# section [mysqld_safe] -table_cache=510 - # Maximum size for internal (in-memory) temporary tables. If a table # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many @@ -125,18 +114,6 @@ thread_cache_size=12 #*** MyISAM Specific options -# The maximum size of the temporary file MySQL is allowed to use while -# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. -# If the file-size would be bigger than this, the index will be created -# through the key cache (which is slower). -myisam_max_sort_file_size=100G - -# If the temporary file used for fast index creation would be bigger -# than using the key cache by the amount specified here, then prefer the -# key cache method. This is mainly used to force long character keys in -# large tables to use the slower key cache method to create the index. -myisam_max_extra_sort_file_size=100G - # If the temporary file used for fast index creation would be bigger # than using the key cache by the amount specified here, then prefer the # key cache method. This is mainly used to force long character keys in @@ -170,13 +147,6 @@ sort_buffer_size=203K # and speed up some things. #skip-innodb -# Additional memory pool that is used by InnoDB to store metadata -# information. If InnoDB requires more memory for this purpose it will -# start to allocate it from the OS. As this is fast enough on most -# recent operating systems, you normally do not need to change this -# value. SHOW INNODB STATUS will display the current amount used. -innodb_additional_mem_pool_size=2M - # If set to 1, InnoDB will flush (fsync) the transaction logs to the # disk at each commit, which offers full ACID behavior. If you are # willing to compromise this safety, and you are running small @@ -234,10 +204,6 @@ log-error=WAMPROOT/logs/mysql.log #Path to the database root datadir=WAMPROOT/bin/mysql/data -# The default character set that will be used when a new schema or table is -# created and no character set is defined -default-character-set=latin1 - # The default storage engine that will be used when create new tables when default-storage-engine=INNODB @@ -258,13 +224,6 @@ max_connections=255 # slowdown instead of a performance improvement. query_cache_size=8M -# The number of open tables for all threads. Increasing this value -# increases the number of file descriptors that mysqld requires. -# Therefore you have to make sure to set the amount of open files -# allowed to at least 4096 in the variable "open-files-limit" in -# section [mysqld_safe] -table_cache=510 - # Maximum size for internal (in-memory) temporary tables. If a table # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many @@ -282,18 +241,6 @@ thread_cache_size=12 #*** MyISAM Specific options -# The maximum size of the temporary file MySQL is allowed to use while -# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. -# If the file-size would be bigger than this, the index will be created -# through the key cache (which is slower). -myisam_max_sort_file_size=100G - -# If the temporary file used for fast index creation would be bigger -# than using the key cache by the amount specified here, then prefer the -# key cache method. This is mainly used to force long character keys in -# large tables to use the slower key cache method to create the index. -myisam_max_extra_sort_file_size=100G - # If the temporary file used for fast index creation would be bigger # than using the key cache by the amount specified here, then prefer the # key cache method. This is mainly used to force long character keys in @@ -327,13 +274,6 @@ sort_buffer_size=203K # and speed up some things. #skip-innodb -# Additional memory pool that is used by InnoDB to store metadata -# information. If InnoDB requires more memory for this purpose it will -# start to allocate it from the OS. As this is fast enough on most -# recent operating systems, you normally do not need to change this -# value. SHOW INNODB STATUS will display the current amount used. -innodb_additional_mem_pool_size=2M - # If set to 1, InnoDB will flush (fsync) the transaction logs to the # disk at each commit, which offers full ACID behavior. If you are # willing to compromise this safety, and you are running small diff --git a/build/exe/doliwamp/startdoliwamp.bat b/build/exe/doliwamp/startdoliwamp.bat index d6842c56010..6e1d6f2641d 100644 --- a/build/exe/doliwamp/startdoliwamp.bat +++ b/build/exe/doliwamp/startdoliwamp.bat @@ -10,9 +10,11 @@ NET START doliwampapache >> doliwamp.log 2>>&1 echo NET START doliwampmysqld >> doliwamp.log 2>>&1 NET START doliwampmysqld >> doliwamp.log 2>>&1 +REM You can also check logs into c:/dolibarr/logs if start fails + echo Please wait... echo ---- End script >> doliwamp.log 2>>&1 REM sleep is not a Windows commande -REM sleep 1 -ping 1.1.1.1 -n 1 -w 1000 > nul \ No newline at end of file +REM sleep 2 +ping 127.0.0.1 -n 2 -w 1000 > nul diff --git a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install index 751302c0633..540f8bc9fbc 100644 --- a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install +++ b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install @@ -12,6 +12,7 @@ start WAMPROOT\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -f conf\httpd.co echo echo Running Mysql as user process (this process does not return so we use "start") -start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console +REM start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console +start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console pause \ No newline at end of file diff --git a/build/exe/doliwamp/stopdoliwamp.bat b/build/exe/doliwamp/stopdoliwamp.bat index e4d2ce07c29..e7f8caefb77 100644 --- a/build/exe/doliwamp/stopdoliwamp.bat +++ b/build/exe/doliwamp/stopdoliwamp.bat @@ -15,4 +15,6 @@ echo ---- End script >> doliwamp.log 2>>&1 REM sleep is not a Windows command REM sleep 1 -ping 1.1.1.1 -n 1 -w 1000 > nul \ No newline at end of file +ping 1.1.1.1 -n 1 -w 1000 > nul + +REM pause From bad758f2483b8076183b9396bc0f0ed04e6b6b31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 19:10:52 +0200 Subject: [PATCH 113/144] Fix syntax error --- build/exe/doliwamp/phpmyadmin.conf.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/exe/doliwamp/phpmyadmin.conf.install b/build/exe/doliwamp/phpmyadmin.conf.install index 533a5289433..7c0c2f8141c 100644 --- a/build/exe/doliwamp/phpmyadmin.conf.install +++ b/build/exe/doliwamp/phpmyadmin.conf.install @@ -31,5 +31,5 @@ Alias /phpmyadmin "WAMPROOT/apps/phpmyadminWAMPPHPMYADMINVERSION/" Require ip 127.0.0.1 Require host localhost - + \ No newline at end of file From de157d90990513c571dc36c7ea81560db0737edc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 20:15:26 +0200 Subject: [PATCH 114/144] Fix quick search on tasks --- htdocs/core/ajax/selectsearchbox.php | 8 ++++++-- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/tasks/list.php | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 416975acfdb..161ed89f4e8 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-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 @@ -62,13 +62,17 @@ if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJ { $arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); } +if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) +{ + $arrayresult['searchintotasks']=array('text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue)); +} if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) { $arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); } -if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->user->user->lire) +if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) { $arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 329277b9796..b90d02f8f77 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -744,6 +744,7 @@ SearchIntoMembers=Members SearchIntoUsers=Users SearchIntoProductsOrServices=Products or services SearchIntoProjects=Projects +SearchIntoTasks=Tasks SearchIntoCustomerInvoices=Customer invoices SearchIntoSupplierInvoices=Supplier invoices SearchIntoCustomerOrders=Customer orders diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 52e01d445a8..cbef511bae7 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -38,7 +38,11 @@ $id=GETPOST('id','int'); $search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); -if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) $search_projectstatus=1; +if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) +{ + if ($search_all != '') $search_projectstatus=-1; + else $search_projectstatus=1; +} else $search_projectstatus=GETPOST('search_projectstatus'); $search_project_ref=GETPOST('search_project_ref'); $search_project_title=GETPOST('search_project_title'); From 9992704398545f57339d217c81d1ec0c38414d5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 20:50:28 +0200 Subject: [PATCH 115/144] Fix: viewimage must not check login for resources medias --- htdocs/viewimage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 585db4c343e..b6d33de99ae 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -34,8 +34,9 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks -// Pour autre que companylogo, on charge environnement + info issus de logon comme le user +// Some value of modulepart can be used to get resources that are public so no login are required. if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); /** * Header empty From 0649c41bbfb0a8b94072bdc5011e504c76305c1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 21:06:02 +0200 Subject: [PATCH 116/144] Fix: list of fields used for quick search was not visible on expense reports --- htdocs/core/ajax/selectsearchbox.php | 4 +- htdocs/expensereport/list.php | 71 +++++++++++++++++++++------- 2 files changed, 55 insertions(+), 20 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 161ed89f4e8..f9200810bdd 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -118,11 +118,11 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_ // HR if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) { - $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) { - $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d269757af7e..e09a74e20f3 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro @@ -51,22 +51,21 @@ $month_end = GETPOST("month_end","int"); $year_end = GETPOST("year_end","int"); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers -{ - $search_ref=""; - $search_user=""; - $search_amount_ht=""; - $search_amount_ttc=""; - $search_status=""; - $month_start=""; - $year_start=""; - $month_end=""; - $year_end=""; -} - if ($search_status == '') $search_status=-1; if ($search_user == '') $search_user=-1; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='expensereportlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expensereportlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('expensereport'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'd.ref'=>'Ref', @@ -75,6 +74,33 @@ $fieldstosearchall = array( ); + +/* + * Actions + */ + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers +{ + $search_ref=""; + $search_user=""; + $search_amount_ht=""; + $search_amount_ttc=""; + $search_status=""; + $month_start=""; + $year_start=""; + $month_end=""; + $year_end=""; + $search_array_options=array(); +} + + + /* * View */ @@ -108,7 +134,6 @@ $sql.= " u.rowid as id_user, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.entity = ".$conf->entity; - // Search all if (!empty($sall)) { @@ -192,13 +217,22 @@ if ($resql) $i = 0; $param=""; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_user) $param.="&search_user=".$search_user; if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc; if ($search_status >= 0) $param.="&search_status=".$search_status; - if ($optioncss != '') $param.='&optioncss='.$optioncss; - + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print '
'."\n"; if ($optioncss != '') print ''; @@ -210,8 +244,9 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + print ''; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","",$param,'',$sortfield,$sortorder); From c24d68a0382381b8599d96f5904e449dec660c66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2016 21:06:02 +0200 Subject: [PATCH 117/144] Picto for expense report --- htdocs/core/ajax/selectsearchbox.php | 4 +- htdocs/expensereport/list.php | 71 +++++++++++++++++++------- htdocs/theme/eldy/img/object_trip.png | Bin 337 -> 369 bytes 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 161ed89f4e8..f9200810bdd 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -118,11 +118,11 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_ // HR if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) { - $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) { - $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d269757af7e..e09a74e20f3 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro @@ -51,22 +51,21 @@ $month_end = GETPOST("month_end","int"); $year_end = GETPOST("year_end","int"); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers -{ - $search_ref=""; - $search_user=""; - $search_amount_ht=""; - $search_amount_ttc=""; - $search_status=""; - $month_start=""; - $year_start=""; - $month_end=""; - $year_end=""; -} - if ($search_status == '') $search_status=-1; if ($search_user == '') $search_user=-1; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='expensereportlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expensereportlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('expensereport'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'd.ref'=>'Ref', @@ -75,6 +74,33 @@ $fieldstosearchall = array( ); + +/* + * Actions + */ + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers +{ + $search_ref=""; + $search_user=""; + $search_amount_ht=""; + $search_amount_ttc=""; + $search_status=""; + $month_start=""; + $year_start=""; + $month_end=""; + $year_end=""; + $search_array_options=array(); +} + + + /* * View */ @@ -108,7 +134,6 @@ $sql.= " u.rowid as id_user, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.entity = ".$conf->entity; - // Search all if (!empty($sall)) { @@ -192,13 +217,22 @@ if ($resql) $i = 0; $param=""; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_user) $param.="&search_user=".$search_user; if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc; if ($search_status >= 0) $param.="&search_status=".$search_status; - if ($optioncss != '') $param.='&optioncss='.$optioncss; - + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''."\n"; if ($optioncss != '') print ''; @@ -210,8 +244,9 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + print '
'; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","",$param,'',$sortfield,$sortorder); diff --git a/htdocs/theme/eldy/img/object_trip.png b/htdocs/theme/eldy/img/object_trip.png index 95cc4412111f7ec23f1295471416152743455e88..d911bd621ded42003fdbbe193de6cbb849193dc3 100644 GIT binary patch delta 334 zcmV-U0kQtk0`UTn7=H)@0000emfhn3004(jOjJeA# zy_|%`oP^%q-js}coRoW%jB~xEjLxNm=ib(ggmbN&jJ2hd=fs(ft4S8Hx79yC^uD zA|e+P3UucHj2i}=pXVGy7zONSQMYK gs_W*P$QIEF6*CII=e>kh3;+NC07*qoM6N<$g6H6;g#Z8m delta 301 zcmey!bdhO-L>LP*0|Ud`G=oP#O0UE z!N|bC6i8T^8e16{DQFuQ8W`y0_kIKFWH0gbb!ETG!Y3?jx%-n+&BSvO^(^U*zK#qG z8~eHcB(eh47zFr)xZ2vCnslTXBQV2S65e0m@r|%f(2{WuHCwI>)yS4j~zR9 z?%cU+*RDN({`~*{|28Vx4M4pDB|(0{KrS+1c%U3B36%5mba4!+xRv~apOI%rhPb#m zqrltE&%gM5tV;QHX4T^}?+=#juDVmt_TJcfd-jwJrl0A3*XLFrS#WXM-nGX}Iu9N- nIdbLb(e{V_8E5|IC;n&TS>nRJzTtr_&}arvS3j3^P6 Date: Mon, 4 Jul 2016 10:28:11 +0200 Subject: [PATCH 118/144] FIX link to check prof id was hardcoded instead of using dedicated function --- htdocs/admin/company.php | 17 ++++++++-- htdocs/societe/class/societe.class.php | 43 ++++++++++++++++---------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 46e83975498..4ebbd2096f9 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -823,7 +823,8 @@ else if (! empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; - if ($mysoc->country_code == 'FR') print '   '.$langs->trans("Check").''; + $s = $mysoc->id_prof_url(1,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -838,6 +839,8 @@ else if (! empty($conf->global->MAIN_INFO_SIRET)) { print $conf->global->MAIN_INFO_SIRET; + $s = $mysoc->id_prof_url(2,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -852,6 +855,8 @@ else if (! empty($conf->global->MAIN_INFO_APE)) { print $conf->global->MAIN_INFO_APE; + $s = $mysoc->id_prof_url(3,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -866,6 +871,8 @@ else if (! empty($conf->global->MAIN_INFO_RCS)) { print $conf->global->MAIN_INFO_RCS; + $s = $mysoc->id_prof_url(4,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -880,6 +887,8 @@ else if (! empty($conf->global->MAIN_INFO_PROFID5)) { print $conf->global->MAIN_INFO_PROFID5; + $s = $mysoc->id_prof_url(5,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -894,6 +903,8 @@ else if (! empty($conf->global->MAIN_INFO_PROFID6)) { print $conf->global->MAIN_INFO_PROFID6; + $s = $mysoc->id_prof_url(6,$mysoc); + if ($s) print ' - '.$s; } else { print ' '; } @@ -909,9 +920,9 @@ else $s=''; $s.=$conf->global->MAIN_INFO_TVAINTRA; $s.=''; - if (empty($conf->global->MAIN_DISABLEVATCHECK)) + if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC()) { - $s.='   '; + $s.=' - '; if (! empty($conf->use_javascript_ajax)) { print "\n"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2dc50975abe..acc4dc75102 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2608,7 +2608,7 @@ class Societe extends CommonObject * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) * @param Societe $soc Objet societe * @return int <=0 if KO, >0 if OK - * TODO not in business class + * TODO better to have this in a lib than into a business class */ function id_prof_check($idprof,$soc) { @@ -2720,27 +2720,38 @@ class Societe extends CommonObject } /** - * Renvoi url de verification d'un identifiant professionnal + * Return an url to check online a professional id or empty string * - * @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm) - * @param Societe $soc Objet societe - * @return string url ou chaine vide si aucune url connue - * TODO not in business class + * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) + * @param Societe $thirdparty Object thirdparty + * @return string Url or empty string if no URL known + * TODO better in a lib than into business class */ - function id_prof_url($idprof,$soc) + function id_prof_url($idprof,$thirdparty) { - global $conf,$langs; - - if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; + global $conf,$langs,$hookmanager; $url=''; + + $hookmanager->initHooks(array('idprofurl')); + $parameters=array('idprof'=>$idprof, 'company'=>$thirdparty); + $reshook=$hookmanager->executeHooks('getIdProfUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return ''; - if ($idprof == 1 && $soc->country_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->idprof1; - if ($idprof == 1 && ($soc->country_code == 'GB' || $soc->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; - if ($idprof == 1 && $soc->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->idprof1; - if ($idprof == 1 && $soc->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$soc->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; - - if ($url) return '['.$langs->trans("Check").']'; + if ($idprof == 1 && $thirdparty->country_code == 'FR') $url='http://www.societe.com/cgi-bin/search?champs='.$thirdparty->idprof1; // See also http://avis-situation-sirene.insee.fr/ + if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; + if ($idprof == 1 && $thirdparty->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$thirdparty->idprof1; + if ($idprof == 1 && $thirdparty->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$thirdparty->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + + if ($url) return ''.$langs->trans("Check").''; + } + else + { + return $hookmanager->resPrint; + } + return ''; } From 22f028d1017fb245964577c130d2c179bd0bb3fe Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 5 Jul 2016 09:05:10 +0200 Subject: [PATCH 119/144] FIX hidden extrafield feature edit --- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 64c78c43c2e..9f894095807 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -85,7 +85,9 @@ $alwayseditable=$extrafields->attribute_alwayseditable[$attrname]; $param=$extrafields->attribute_param[$attrname]; $perms=$extrafields->attribute_perms[$attrname]; $list=$extrafields->attribute_list[$attrname]; -//$ishidden=$extrafields->attribute_hidden[$attrname]; +if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { + $ishidden=$extrafields->attribute_hidden[$attrname]; +} if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) { From fc2e7fb1ad70f5d61c1c2a5a2133c17ef74bd11d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 5 Jul 2016 15:45:33 +0200 Subject: [PATCH 120/144] FIX #5446 --- htdocs/core/class/extrafields.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 32f0790fd89..1a362d143dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -794,11 +794,7 @@ class ExtraFields // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value $keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid'); - if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) - { - list($parentName, $parentField) = explode('|', $InfoFieldList[3]); - $keyList.= ', '.$parentField; - } + if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4])) { if (strpos($InfoFieldList[4], 'extra.') !== false) @@ -808,6 +804,11 @@ class ExtraFields $keyList=$InfoFieldList[2].' as rowid'; } } + if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) + { + list($parentName, $parentField) = explode('|', $InfoFieldList[3]); + $keyList.= ', '.$parentField; + } $fields_label = explode('|',$InfoFieldList[1]); if (is_array($fields_label)) From d658e2cf31c86199df52b629771a16bc4701222a Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 5 Jul 2016 16:04:18 +0200 Subject: [PATCH 121/144] FIX task ODT company object not correctly retrieved --- .../modules/project/task/doc/doc_generic_task_odt.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 2b60695db51..039c3002bdf 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -415,6 +415,7 @@ class doc_generic_task_odt extends ModelePDFTask } $project= new Project($this->db); $project->fetch($object->fk_project); + $project->fetch_thirdparty(); $dir = $conf->projet->dir_output. "/" . $project->ref. "/"; $objectref = dol_sanitizeFileName($object->ref); @@ -449,7 +450,7 @@ class doc_generic_task_odt extends ModelePDFTask dol_mkdir($conf->projet->dir_temp); - $socobject=$object->thirdparty; + $socobject=$project->thirdparty; // Make substitution $substitutionarray=array( From b4c8822281adfaa9c3499160abdbce46381ccee1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2016 16:27:14 +0200 Subject: [PATCH 122/144] Fix style of text after ref on invoices --- htdocs/compta/facture.php | 6 +++--- htdocs/core/class/html.form.class.php | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 14f3ea7075f..9b2d39c4487 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2930,16 +2930,16 @@ else if ($id > 0 || ! empty($ref)) // Ref print ''; print ''; // Ref customer diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d4267eccfb1..507f45a12f8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5582,10 +5582,11 @@ class Form * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name * @param string $morehtmlleft More html code to show before ref - * @param string $morehtmlright More html code to show before navigation arrows + * @param string $morehtmlstatus More html code to show under navigation arrows (status place) + * @param string $morehtmlright More html code to show after ref * @return string Portion HTML avec ref + boutons nav */ - function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlright='') + function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') { global $langs,$conf; @@ -5604,7 +5605,7 @@ class Form //print "xx".$previous_ref."x".$next_ref; $ret.='
'; - $ret.='
'.$morehtmlleft.'
'; + if ($morehtmlleft) $ret.='
'.$morehtmlleft.'
'; $ret.='
'; @@ -5624,6 +5625,8 @@ class Form } $ret.='
'; + if ($morehtmlright) $ret.='
'.$morehtmlright.'
'; + if ($previous_ref || $next_ref || $morehtml) { $ret.=''; } - if ($morehtmlright) $ret.='
'.$morehtmlright.'
'; + if ($morehtmlstatus) $ret.='
'.$morehtmlstatus.'
'; $ret.='
'; return $ret; From 50c5efc374a6591ae10ca76c18b803a7b166e022 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Tue, 5 Jul 2016 16:41:46 +0200 Subject: [PATCH 123/144] Fix: Don't load extrafields on orderstoinvoice --- htdocs/commande/orderstoinvoice.php | 14 ++++++++++++++ htdocs/fourn/commande/orderstoinvoice.php | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 7a8814edd4d..3bef2f412c1 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -70,6 +70,11 @@ $date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endda $date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('facture'); + if ($action == 'create') { if (is_array($selected) == false) @@ -174,6 +179,9 @@ if (($action == 'create' || $action == 'add') && !$error) $object->remise_absolue = $_POST['remise_absolue']; $object->remise_percent = $_POST['remise_percent']; + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + if ($_POST['origin'] && $_POST['originid']) { $object->origin = $_POST['origin']; @@ -464,6 +472,12 @@ if ($action == 'create' && !$error) $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + $object=new Facture($db); + print $object->showOptionals($extrafields,'edit'); + } + // Modele PDF print ''; print ''; print ''; } print ''; - } $db->free($resql); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 81121f3b4bf..5d88dd78977 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -64,13 +64,13 @@ $search_status=GETPOST('search_status'); $sall=GETPOST('sall'); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_ref=""; - $search_company=""; - $search_desc=""; - $search_status=""; -} +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('interventionlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('fichinter'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -82,6 +82,52 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']); +// Definition of fields for list +$arrayfields=array( + 'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 'f.fk_project'=>array('label'=>$langs->trans("Project"), 'checked'=>1), + 'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), + 'f.description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), + 'fd.description'=>array('label'=>"xx", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} + + +/* + * Acions + */ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_ref=""; + $search_company=""; + $search_project=""; + $search_contract=""; + $search_desc=""; + $search_status=""; + $search_array_options=array(); +} + + /* * View @@ -94,13 +140,20 @@ llxHeader('', $langs->trans("Intervention")); $sql = "SELECT"; -$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,"; +$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql.= " s.nom as name, s.rowid as socid, s.client"; -$sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; -if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= ", ".MAIN_DB_PREFIX."fichinter as f)"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " AND f.entity = ".$conf->entity; if ($search_ref) { @@ -123,6 +176,23 @@ if ($socid) if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); $totalnboflines=0; @@ -149,7 +219,14 @@ if ($result) if ($search_desc) $param.="&search_desc=".urlencode($search_desc); if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status); if ($optioncss != '') $param.='&optioncss='.$optioncss; - + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + print ''."\n"; if ($optioncss != '') print ''; print ''; @@ -165,42 +242,120 @@ if ($result) foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - - print '
' . $langs->trans('Ref') . ''; - $morehtmlref = ''; + $morehtmlright = ''; $discount = new DiscountAbsolute($db); $result = $discount->fetch(0, $object->id); if ($result > 0) { - $morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; + $morehtmlright = '  (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; } if ($result < 0) { dol_print_error('', $discount->error); } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); + print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', '', '', 0, '', '', $morehtmlright); print '
'.$langs->trans('Model').''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index e11e70b12ef..2d89ad406c0 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -71,6 +71,11 @@ $date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_e $date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('facture_fourn'); + if ($action == 'create') { if (is_array($selected) == false) { $mesgs = array ( @@ -160,6 +165,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { if (empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + if ($_POST['origin'] && $_POST['originid']) { $object->linked_objects = $orders_id; $id = $object->create($user); @@ -337,6 +345,12 @@ if ($action == 'create' && !$error) { ); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + $object=new FactureFournisseur($db); + print $object->showOptionals($extrafields,'edit'); + } + // Modele PDF print '
' . $langs->trans('Model') . ''; From 770da29de4e0382cdf3db74e17b023de6a7ec2e2 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Tue, 5 Jul 2016 17:20:32 +0200 Subject: [PATCH 124/144] internationalization of code comment --- htdocs/categories/class/categorie.class.php | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8636232b405..60e132f3051 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1008,13 +1008,13 @@ class Categorie extends CommonObject } /** - * Affiche contenu de $this->cats + * Display content of $this->cats * * @return void */ function debug_cats() { - // Affiche $this->cats + // Display $this->cats foreach($this->cats as $key => $val) { print 'id: '.$this->cats[$key]['id']; @@ -1029,11 +1029,11 @@ class Categorie extends CommonObject /** - * Retourne toutes les categories + * Returns all categories * * @param int $type Type of category * @param boolean $parent Just parent categories if true - * @return array Tableau d'objet Categorie + * @return array Table of Object Category */ function get_all_categories($type=null, $parent=false) { @@ -1064,9 +1064,9 @@ class Categorie extends CommonObject } /** - * Retourne le nombre total de categories + * Returns total number of categories * - * @return int Nombre de categories + * @return int Number of categories * @deprecated function not used ? */ function get_nb_categories() @@ -1133,7 +1133,7 @@ class Categorie extends CommonObject } /** - * Retourne les categories de premier niveau (qui ne sont pas filles) + * Returns the top level categories (which are not girls) * * @param int $type Type of category * @return array @@ -1144,8 +1144,8 @@ class Categorie extends CommonObject } /** - * Retourne les chemin de la categorie, avec les noms des categories - * separes par $sep (" >> " par defaut) + * Returns the path of the category, with the names of the categories + * separated by $sep (" >> " by default) * * @param string $sep Separator * @param string $url Url @@ -1205,7 +1205,7 @@ class Categorie extends CommonObject /** - * Retourne un tableau contenant la liste des categories meres + * Returns an array containing the list of parent categories * * @return int|array <0 KO, array OK */ @@ -1239,8 +1239,8 @@ class Categorie extends CommonObject } /** - * Retourne dans un tableau tous les chemins possibles pour arriver a la categorie - * en partant des categories principales, representes par des tableaux de categories + * Returns in a table all possible paths to get to the category + * starting with the major categories represented by Tables of categories * * @return array */ @@ -1324,8 +1324,8 @@ class Categorie extends CommonObject /** - * Retourne les categories dont l'id ou le nom correspond - * ajoute des wildcards au nom sauf si $exact = true + * Returns categories whose id or name match + * add wildcards in the name unless $exact = true * * @param int $id Id * @param string $nom Name From a669b61b69760e6a60b6e82d550a717f1c19f455 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2016 18:33:13 +0200 Subject: [PATCH 125/144] Code comment --- htdocs/compta/facture/list.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 989aa6a6692..0e9c6874103 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -699,7 +699,13 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); +if ($search_status != '' && $search_status >= 0) +{ + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some correupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned +} if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; if ($month > 0) { From 6749e60079deb2dd6d5dddfc1d2d05727513b86a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2016 18:36:10 +0200 Subject: [PATCH 126/144] Fix: Test to manage corrupted data --- htdocs/compta/facture.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9b2d39c4487..6535cee7c98 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -163,7 +163,7 @@ if (empty($reshook)) // Change status of invoice else if ($action == 'reopen' && $user->rights->facture->creer) { $result = $object->fetch($id); - if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) { + if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted $result = $object->set_unpaid($user); if ($result > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); @@ -3905,8 +3905,8 @@ else if ($id > 0 || ! empty($ref)) if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))) - && ($object->statut == 2 || $object->statut == 3) - && $user->rights->facture->creer) // A paid invoice (partially or completely) + && ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data + && $user->rights->facture->creer) // A paid invoice (partially or completely) { if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice { From da5228aaa9419ecab6afbc1d4a18afc59484284a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 10:28:34 +0200 Subject: [PATCH 127/144] Selection of fields ok for interventions --- htdocs/commande/list.php | 1 - htdocs/fichinter/list.php | 374 +++++++++++++++++++++++++++++++------- htdocs/user/index.php | 11 ++ 3 files changed, 318 insertions(+), 68 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f19a431ec10..47cee9903ef 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1030,7 +1030,6 @@ if ($resql) else print '
'; + $moreforfilter=''; + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],''); + if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - print_liste_field_titre('',$_SERVER["PHP_SELF"],''); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder); + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; print ''; - print ''; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Desc of line - print ''; - print ''; + if (! empty($arrayfields['f.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.description']['checked'])) + { + print ''; + } + if (! empty($arrayfields['fd.description']['checked'])) + { + // Desc of line print ''; + } + if (! empty($arrayfields['fd.date']['checked'])) + { + print ''; + } + if (! empty($arrayfields['fd.duree']['checked'])) + { + print ''; } - print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['f.datec']['checked'])) + { + // Date creation + print ''; + } + if (! empty($arrayfields['f.tms']['checked'])) + { + // Date modification + print ''; + } + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + } print '"; - print "\n"; - print ''; - print ''; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if (! empty($arrayfields['f.ref']['checked'])) { - //print ''; - print ''; - print '\n"; - print ''; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['f.description']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.description']['checked'])) + { + //print ''; + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.date']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['fd.duree']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; + $totalarray['totalduration']+=$obj->duree; } - print ''; - print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['f.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['f.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; - $total += $objp->duree; + $total += $obj->duree; $i++; } - $rowspan=3; - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + + // Show total line + if (isset($totalarray['totalduration'])) { - print ''; - print ''; - print ''; + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaldurationfield'] == $i) print ''; + else print ''; + } + print ''; } print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '  '; + print ''; + print ''; + print ''; + print ''; + print ''; + print '   '; - $liststatus=$interventionstatic->statuts_short; - print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); - print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + $liststatus=$interventionstatic->statuts_short; + print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); + print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -212,44 +367,129 @@ if ($result) $var=True; $total = 0; $i = 0; + $totalarray=array(); while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); + $obj = $db->fetch_object($result); + + $interventionstatic->id=$obj->fichid; + $interventionstatic->ref=$obj->ref; + $interventionstatic->statut=$obj->fk_statut; + $var=!$var; print "
"; - $interventionstatic->id=$objp->fichid; - $interventionstatic->ref=$objp->ref; - print $interventionstatic->getNomUrl(1); - print "'; - $companystatic->name=$objp->name; - $companystatic->id=$objp->socid; - $companystatic->client=$objp->client; - print $companystatic->getNomUrl(1,'',44); - print ''.dol_trunc(dolGetFirstLineOfText($objp->description),48).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($objp->descriptiondetail)),48).''.dolGetFirstLineOfText($objp->descriptiondetail).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).'"; + print $interventionstatic->getNomUrl(1); + print "'; + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + $companystatic->client=$obj->client; + print $companystatic->getNomUrl(1,'',44); + print ''.dol_trunc(dolGetFirstLineOfText($obj->description),48).''.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($obj->descriptiondetail)),48).''.dolGetFirstLineOfText($obj->descriptiondetail).''.dol_print_date($db->jdate($obj->dp),'dayhour')."'.convertSecondToTime($obj->duree, 'allhourmin').''.$interventionstatic->LibStatut($objp->fk_statut,5).' '; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$interventionstatic->LibStatut($obj->fk_statut,5).'
'.$langs->trans("Total").''.convertSecondToTime($total).'  
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'
'; @@ -264,4 +504,4 @@ else llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index f7927cee665..5d8f02e1c32 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -229,6 +229,15 @@ $sql.=$hookmanager->resPrint; $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); +/*$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); +*/ $result = $db->query($sql); if ($result) { @@ -236,6 +245,8 @@ if ($result) $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall != '') $param.='&sall='.urlencode($sall); if ($search_user != '') $param.="&search_user=".$search_user; if ($search_login != '') $param.="&search_login=".$search_login; From 97eedb866bedf92be38af7e84974920776767f13 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Wed, 6 Jul 2016 10:36:58 +0200 Subject: [PATCH 128/144] FIX add POST key on print link (avoid action in case of) in order to keep filter on list and other case --- htdocs/main.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5e919498a9b..3f790907fc1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1480,7 +1480,12 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone)) { $qs=$_SERVER["QUERY_STRING"]; - $qs.=(($qs && $morequerystring)?'&':'').$morequerystring; + + foreach($_POST as $key=>$value) { + if($key!=='action')$qs.='&'.$key.'='.urlencode($value); + } + + $qs.=(($qs && $morequerystring)?'&':'').$morequerystring; $text =''; $text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); $text.=''; From a2e26e6ba0015b43f815b0f283331aa1ee58b67c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 10:49:19 +0200 Subject: [PATCH 129/144] Upgrade apache and php for DoliWamp but not Mysql --- build/exe/doliwamp/doliwamp.iss | 23 ++++++++----------- .../exe/doliwamp/install_services.bat.install | 4 ++-- build/exe/doliwamp/my.ini.install | 2 +- .../startdoliwamp_manual_donotuse.bat.install | 4 ++-- .../doliwamp/uninstall_services.bat.install | 4 ++-- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index cc5235b58c2..3c1b2f5bf93 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -99,13 +99,13 @@ Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; F Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion; ; PhpMyAdmin, Apache, Php, Mysql ; Put here path of Wampserver applications -; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 or 5.1.36 -; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36 -; Value ???: apache 2.4.19, php 5.5.12, mysql 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) +; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 +; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 +; Value ???: apache 2.4.19, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange" Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" -Source: "C:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" +Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" ; Mysql data files (does not overwrite if exists) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db" ; Dolibarr @@ -119,7 +119,7 @@ Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Fl Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion; Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion; Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; -Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion; +Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion; Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion; Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion; Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; @@ -198,7 +198,7 @@ begin //version des applis, a modifier pour chaque version de WampServer 2 apacheVersion := '2.4.9'; phpVersion := '5.5.12' ; - mysqlVersion := '5.6.17'; + mysqlVersion := '5.0.45'; phpmyadminVersion := '4.1.14'; smtpServer := 'localhost'; @@ -308,8 +308,6 @@ function NextButtonClick(CurPageID: Integer): Boolean; var myResult: Integer; var res: Boolean; var paramok: Boolean; -var datadirold: String; -var datadirnew: String; var exedirold: String; var exedirnew: String; var themessage: String; @@ -328,10 +326,9 @@ begin winPath := ExpandConstant('{win}'); pathWithSlashes := path; StringChange (pathWithSlashes, '\','/'); - datadirold := pathWithSlashes+'/bin/mysql/mysql5.6.17/data'; - datadirnew := pathWithSlashes+'/bin/mysql/data'; - exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17'; - exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17'; + datadir := pathWithSlashes+'/bin/mysql/data'; + exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45'; + exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45'; //---------------------------------------------- @@ -995,7 +992,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec [UninstallDelete] Type: files; Name: "{app}\*.*" -Type: files; Name: "{app}\bin\mysql\mysql5.6.17\*.*" +Type: files; Name: "{app}\bin\mysql\mysql5.0.45\*.*" Type: filesandordirs; Name: "{app}\alias" Type: filesandordirs; Name: "{app}\apps" Type: filesandordirs; Name: "{app}\bin\apache" diff --git a/build/exe/doliwamp/install_services.bat.install b/build/exe/doliwamp/install_services.bat.install index 536a984e26d..5ad43827f86 100644 --- a/build/exe/doliwamp/install_services.bat.install +++ b/build/exe/doliwamp/install_services.bat.install @@ -16,9 +16,9 @@ REM reg add HKLM\SYSTEM\CurrentControlSet\Services\doliwampapache /V Start /t RE REM Mysql 5.0- REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --install-manual doliwampmysqld -REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --install doliwampmysqld +.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --install doliwampmysqld REM Mysql 5.1+ -.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld +REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --install doliwampmysqld echo ---- End script >> doliwamp.log 2>>&1 diff --git a/build/exe/doliwamp/my.ini.install b/build/exe/doliwamp/my.ini.install index 885660f648b..e1a9495e20b 100644 --- a/build/exe/doliwamp/my.ini.install +++ b/build/exe/doliwamp/my.ini.install @@ -196,7 +196,7 @@ port=WAMPMYSQLPORT #Path to installation directory. All paths are usually resolved relative to this. -basedir=WAMPROOT/bin/mysql/mysql5.6.17 +basedir=WAMPROOT/bin/mysql/mysqlWAMPMYSQLVERSION #log file log-error=WAMPROOT/logs/mysql.log diff --git a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install index 540f8bc9fbc..c8e33e4620b 100644 --- a/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install +++ b/build/exe/doliwamp/startdoliwamp_manual_donotuse.bat.install @@ -12,7 +12,7 @@ start WAMPROOT\bin\apache\apacheWAMPAPACHEVERSION\bin\httpd.exe -f conf\httpd.co echo echo Running Mysql as user process (this process does not return so we use "start") -REM start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console -start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console +start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console +REM start WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --defaults-file=WAMPROOT\bin\mysql\mysqlWAMPMYSQLVERSION\my.ini --console pause \ No newline at end of file diff --git a/build/exe/doliwamp/uninstall_services.bat.install b/build/exe/doliwamp/uninstall_services.bat.install index b8aa5027b01..0f12a29b6e2 100644 --- a/build/exe/doliwamp/uninstall_services.bat.install +++ b/build/exe/doliwamp/uninstall_services.bat.install @@ -11,9 +11,9 @@ NET STOP doliwampapache NET STOP doliwampmysqld REM Mysql 5.0- -REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld +.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld-nt.exe --remove doliwampmysqld REM Mysql 5.1+ -.\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --remove doliwampmysqld +REM .\bin\mysql\mysqlWAMPMYSQLVERSION\bin\mysqld.exe --remove doliwampmysqld REM wampmanager.exe -quit -id={doliwampserver} echo ---- End script >> doliwamp.log 2>>&1 From 9249a7c73630f2e0aa8aa52cf7caccbedc96acdc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 11:05:23 +0200 Subject: [PATCH 130/144] Add entry to run stop/start doliwamp as admin --- build/exe/doliwamp/doliwamp.iss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 3c1b2f5bf93..f048d9ac36d 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -146,6 +146,11 @@ Name: "{userdesktop}\Dolibarr Help center"; Filename: "{app}\rundolihelp.bat"; W ;Name: "{userstartup}\DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; Flags: runminimized; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico +[Registry] +Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; +Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; + + [Code] //variables globales @@ -332,7 +337,7 @@ begin //---------------------------------------------- - // Test if VC11Redist has been installed + // Test if msvcr110 DLL has been installed //---------------------------------------------- if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then From 8e19b235f1b25520cfcd6e6c2ca8d104127b2f00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 11:06:49 +0200 Subject: [PATCH 131/144] Code comment --- build/exe/doliwamp/doliwamp.iss | 1 + 1 file changed, 1 insertion(+) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index f048d9ac36d..8b368fa3b8f 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -147,6 +147,7 @@ Name: "{userdesktop}\Dolibarr Help center"; Filename: "{app}\rundolihelp.bat"; W [Registry] +; Add "run as admin" flag. Same than command line: reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "" /t REG_SZ /d RUNASADMIN Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; From c360189d9472ec809554653dbf8ff29c2043336b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 11:14:17 +0200 Subject: [PATCH 132/144] Code comment --- htdocs/core/class/hookmanager.class.php | 7 ++----- htdocs/societe/class/societe.class.php | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 484b6518f77..f4f9a37fcf6 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2016 Laurent Destailleur * Copyright (C) 2010-2014 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * @@ -143,6 +143,7 @@ class HookManager 'formObjectOptions', 'formattachOptions', 'formBuilddocLineOptions', + 'getIdProfUrl', 'moveUploadedFile', 'pdf_build_address', 'pdf_writelinedesc', @@ -247,11 +248,7 @@ class HookManager } } - // TODO remove this. When there is something to print for an output hook, ->resPrint is filled. - //if ($hooktype == 'output') return $this->resPrint; - //if ($hooktype == 'returnvalue') return $result; return ($error?-1:$resaction); } } - diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index acc4dc75102..21bfed210fb 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2732,6 +2732,7 @@ class Societe extends CommonObject global $conf,$langs,$hookmanager; $url=''; + $action = ''; $hookmanager->initHooks(array('idprofurl')); $parameters=array('idprof'=>$idprof, 'company'=>$thirdparty); From 8e9a7cb62940341b35f7d50f6338b36dc36cee35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 11:20:09 +0200 Subject: [PATCH 133/144] Fix var not always defined --- htdocs/adherents/class/cotisation.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 786ba79c7f3..9fe26727c25 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -190,11 +190,12 @@ class Cotisation extends CommonObject */ function delete($user) { + $accountline=new AccountLine($this->db); + // It subscription is linked to a bank transaction, we get it - if ($this->fk_bank) + if ($this->fk_bank > 0) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $accountline=new AccountLine($this->db); $result=$accountline->fetch($this->fk_bank); } From 0af555126cd1ee2f08729bfdc70bb0a800c0c1c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 11:23:32 +0200 Subject: [PATCH 134/144] Fix PHPCS --- .../class/accountancyexport.class.php | 2 +- .../browser/default/browser.php | 28 +++++++++---------- .../browser/default/frmcreatefolder.php | 24 ++++++++-------- .../browser/default/frmupload.php | 20 ++++++------- .../connectors/php/commands.php | 6 ++-- htdocs/core/lib/functions2.lib.php | 4 +-- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 04f66a47026..fd06a164962 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -142,7 +142,7 @@ class AccountancyExport case self::$EXPORT_TYPE_COGILOG : $this->exportCogilog($TData); break; - default : + default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; } diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php index 15e44621bcf..f8262998049 100644 --- a/htdocs/core/filemanagerdol/browser/default/browser.php +++ b/htdocs/core/filemanagerdol/browser/default/browser.php @@ -133,26 +133,26 @@ oConnector.CheckError = function( responseXml ) switch ( iErrorNumber ) { - case 0 : - break ; - case 1 : // Custom error. Message placed in the "text" attribute. + case 0: + break; + case 1: // Custom error. Message placed in the "text" attribute. alert( oErrorNode.attributes.getNamedItem('text').value ); - break ; - case 101 : + break; + case 101: alert( 'Folder already exists' ); - break ; - case 102 : + break; + case 102: alert( 'Invalid folder name' ); - break ; - case 103 : + break; + case 103: alert( 'You have no permissions to create the folder' ); - break ; - case 110 : + break; + case 110: alert( 'Unknown error creating folder' ); - break ; - default : + break; + default: alert( 'Error on your request. Error number: ' + iErrorNumber ); - break ; + break; } } return iErrorNumber ; diff --git a/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php b/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php index 44b00b2154c..6f90c0c36ad 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php +++ b/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php @@ -91,24 +91,24 @@ function CreateFolderCallBack( fckXml ) switch ( iErrorNumber ) { - case 0 : + case 0: window.parent.frames['frmResourcesList'].Refresh(); - break ; - case 101 : + break; + case 101: alert( 'Folder already exists' ); - break ; - case 102 : + break; + case 102: alert( 'Invalid folder name' ); - break ; - case 103 : + break; + case 103: alert( 'You have no permissions to create the folder' ); - break ; - case 110 : + break; + case 110: alert( 'Unknown error creating folder' ); - break ; - default : + break; + default: alert( 'Error creating folder. Error number: ' + iErrorNumber ); - break ; + break; } */ } diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index dd58eded713..10575586cec 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -95,22 +95,22 @@ function OnUploadCompleted( errorNumber, data ) switch ( errorNumber ) { - case 0 : + case 0: window.parent.frames['frmResourcesList'].Refresh(); - break ; - case 1 : // Custom error. + break; + case 1: // Custom error. alert( data ); - break ; - case 201 : + break; + case 201: window.parent.frames['frmResourcesList'].Refresh(); alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); - break ; - case 202 : + break; + case 202: alert( 'Invalid file' ); - break ; - default : + break; + default: alert( 'Error on file upload. Error number: ' + errorNumber ); - break ; + break; } } diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 3f02b9f39fb..5c8e76a9522 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -160,14 +160,14 @@ function CreateFolder( $resourceType, $currentFolder ) switch ( $sErrorMsg ) { - case '' : + case '': $sErrorNumber = '0' ; - break ; + break; case 'Invalid argument' : case 'No such file or directory' : $sErrorNumber = '102' ; // Path too long. break ; - default : + default: $sErrorNumber = '110' ; break ; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 31289eaca3b..7ab1a53d230 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -606,8 +606,8 @@ function clean_url($url,$http=1) * Returns an email value with obfuscated parts. * * @param string $mail Email - * @param string $replace Replacement character (defaul : *) - * @param int $nbreplace Number of replacement character (default : 8) + * @param string $replace Replacement character (defaul: *) + * @param int $nbreplace Number of replacement character (default: 8) * @param int $nbdisplaymail Number of character unchanged (default: 4) * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) * @param bool $displaytld Display tld (default: true) From f39558ebb0d0ebb4f2d600986984678bd3c72be2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 11:24:51 +0200 Subject: [PATCH 135/144] =?UTF-8?q?Fix=20=C4=89onf=20not=20defined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/accountancy/class/accountancyexport.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index fd06a164962..ddc80e00571 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -156,6 +156,8 @@ class AccountancyExport * @return void */ public function exportNormal($objectLines) { + global $conf; + foreach ( $objectLines as $line ) { // Std export $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); From 8505c5db09e82447c12f788d19bea6db9ce151ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 13:26:49 +0200 Subject: [PATCH 136/144] Code comment --- htdocs/core/class/translate.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 06bd6dc0c40..9ca6196b018 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -161,6 +161,7 @@ class Translate { global $conf,$db; + // Load $this->tab_translate[] from database if (count($this->tab_translate) == 0) $this->loadFromDatabase($db); // Nothing was loaded yet, so we load database. // Check parameters @@ -241,7 +242,7 @@ class Translate $tmparray=dol_getcache($usecachekey); if (is_array($tmparray) && count($tmparray)) { - $this->tab_translate+=$tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a valuer already exists into tab_translate, value into tmparaay is not added. + $this->tab_translate+=$tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added. //print $newdomain."\n"; //var_dump($this->tab_translate); if ($alt == 2) $fileread=1; @@ -261,7 +262,8 @@ class Translate { $tab=explode('=',$line,2); $key=trim($tab[0]); - //print "Domain=$domain, found a string for $tab[0] with value $tab[1]
"; + //if ($domain == 'orders') print "Domain=$domain, found a string for $tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."
"; + //if ($key == 'Order') print "Domain=$domain, found a string for key=$key=$tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."
"; if (empty($this->tab_translate[$key]) && isset($tab[1])) // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries) { $value=trim(preg_replace('/\\n/',"\n",$tab[1])); @@ -278,6 +280,7 @@ class Translate else { $this->tab_translate[$key]=$value; + //if ($domain == 'orders') print "$tab[0] value $value
"; if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache } } From d22ef4f371caaa051464b4412ee66eb7c9a31c30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 22:28:13 +0200 Subject: [PATCH 137/144] Fix Do not show status --- htdocs/comm/mailing/card.php | 28 ++++++++++----------- htdocs/comm/mailing/cibles.php | 14 +++++------ htdocs/comm/mailing/class/mailing.class.php | 2 ++ htdocs/filefunc.inc.php | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 443b6144e5a..73717696dc7 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -673,9 +673,9 @@ if ($action == 'create') dol_fiche_head(); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; // Other attributes $parameters=array(); @@ -689,11 +689,11 @@ if ($action == 'create') print '

'; print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print ''; - print ''; + print ''; - print ''; + print ''; print ''; @@ -995,7 +995,7 @@ else print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { @@ -792,7 +792,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'; // Subject - print ''; + print ''; // Joined files print '';*/ // Message - print ''; + print ''; print ''; @@ -1114,9 +1114,9 @@ else print '
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailTopic").''.$object->sujet.'
'.$langs->trans("MailFile").''; @@ -1021,7 +1021,7 @@ else print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { @@ -1055,7 +1055,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'; // Subject - print ''; + print ''; - $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we shoul set a trackid here, even if we use another one into email header. + $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header. dol_init_file_process($upload_dir, $trackid); // Joined files @@ -1156,12 +1156,12 @@ else print ''; // Background color - print ''; // Message - print ''; + print ''; print ''; - print ''; + print ''; - print ''; + print ''; // Errors to - print ''; // Status - print ''; // Nb of distinct emails - print ''; - print ''; + print ''; print ''; print ''."\n"; // Modules @@ -478,7 +478,7 @@ function llxHeaderVierge($title, $head = "") top_htmlhead($head,$title); - print ''."\n"; + print ''."\n"; } /** diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9e9cf97706c..ae8d0e98738 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4292,7 +4292,9 @@ border-top-right-radius: 6px; /* For demo pages */ img.demothumb { - box-shadow: 2px 2px 8px #888; + box-shadow: 2px 2px 8px #BBB; + margin-right: 20px; + margin-left: 10px; } @@ -4329,6 +4331,12 @@ img.demothumb { width: px; } + img.demothumb { + box-shadow: 1px 1px 4px #BBB; + margin-right: 6px; + margin-left: 4px; + width: 80px; + } } /* nboftopmenuentries = , fontsize= */ From e55ae1476a08780b6db08618ed2eb857d145a7ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 23:55:10 +0200 Subject: [PATCH 140/144] Fix innosetup install --- build/exe/doliwamp/Languages/MyFrench.isl | 8 ++++---- build/exe/doliwamp/doliwamp.iss | 2 ++ build/exe/doliwamp/doliwampsmall.bmp | Bin 12814 -> 3318 bytes 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index 0fd71f96bfb..6c1b859a318 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -21,10 +21,10 @@ TechnicalParameters=Param IfFirstInstall=S'il s'agit de la première installation, merci de spécifier ces quelques paramètres techniques. Si vous ne les comprennez pas, êtes non sûr, ou procédez à une mise à jour, laissez les champs avec les valeurs proposées par défaut. -; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 60 CHARACTERS -SMTPServer=Serveur SMTP (le votre ou celui de votre FAI, première installation uniquement) : -ApachePort=Port Apache (première installation uniquement, le choix standard est 80) : -MySqlPort=Port Mysql (première installation uniquement, le choix standard est 3306) : +; WARNING !!! STRINGS FOR THIS 4 STRINGS MUST BE LOWER THAN 70 CHARACTERS +SMTPServer=Serveur SMTP (le votre ou de votre FAI, première installation uniquement): +ApachePort=Port Apache (première installation uniquement, le choix standard est 80): +MySqlPort=Port Mysql (première installation uniquement, le choix standard est 3306): MySqlPassword=Mot de passe serveur+base MySql de root (première installation uniquement): FailedToDeleteLock=Echec de la suppression du fichier %1/www/dolibarr/install.lock. Vous pouvez ignorer l'avertissement mais il est possible que vous deviez le supprimer manuellement plus tard. Dans ce cas, cela vous sera signalé. Cliquez sur OK pour continuer... diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index c82b7b40c47..dfe7febf2db 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -268,6 +268,7 @@ begin if firstinstall then begin + // False means it's not a password edit Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('MySqlPort'), False); @@ -275,6 +276,7 @@ begin end else begin + // False means it's not a password edit Page.Add(CustomMessage('SMTPServer'), False); Page.Add(CustomMessage('ApachePort'), False); Page.Add(CustomMessage('MySqlPort'), False); diff --git a/build/exe/doliwamp/doliwampsmall.bmp b/build/exe/doliwamp/doliwampsmall.bmp index f19e98fd19ae2423acaa635fa3fd23f4584fcbdf..f4d51aa02293ebcfa1b80cdda09298e736569d6d 100644 GIT binary patch literal 3318 zcmcJQ=~Gfs7>Dh9e}Ii8W}0b;kyb=DnSD&t3X4opmbNja)fUTb1SZ1`FsuyF$~3cG zjcLyfH?SE?jV4EucC%@bvBElXXXM-$Z2EHVJonD|z4txOIhVO}iHshb>ESq*qU!>5 z`k>PnoijW<(bdD_5xOs#O`MJbx*U%3qLic2b0{Sv#+y=($Iz%{z0Ywf$=Wa%kQwWJ zY@HX0m^qoTw2Uavqia1gqGq96D1uqj#azxjfLGAee{x0jhkRK2x-RA=lWUV{-1g(T zDm{neOETcLIKRBj{(z>sQlPT*cUMXHporqc#00upo_9*P0YEYpCEWRd=DJfr^}4_7 zl2ibSc(j_I0?AaAaszN=TLN0Hy7&i-)iNP2#K*)_G}ozeH~QczVtit2AfWY{8lR5F zuLq1ZG7%`cMpeoxph7V}AqdcV9r}j{y47isdQJAdO6jwfTVvlwk(}5zzKYrSP{#EK zHaU+DXuDB{&q8D5KbaVW=E}H!c^hf@34wRDIj&2fbtN1cuodv=fVLZ_f#3SVRG7qY zwj~AU$ImyowAt;yb%)l;6Bjx=dGx}hV1VJKtKV3}XOP?I3Q^dvaU1xR8p;mI6NB*1 zVm<@Ve(Ma}zu8nG2mx&;cRVPNrjRicb0Ao1$5pn2eaOq zO{Lqz@HQo%@$kG9v`yIUwGy66$izEO?Fa>Q)kDA4Y*GnBl!9QTfL@ZcK#{yqUzTqF z{mb$BaV~tXx0?kdQ&F472K4Cvz5mJoEaI^AHa8US)TFY2 z0gpQI3KDz54OfarhF^TL^ttk3u-Dqx{<5RdP%E!F7OkB$FV~5~Nd~g;{Jxcdial&y r8p}Q6aO1XS^4W;}A=hP+) literal 12814 zcmds+`CC*~9LDJ%=(p-AO;JHXHn9xR%+k_aK*bG#PyrE1OH{;^MV0|&7}g0ChD8%W z#oQh;;K?>kOrgwD5SLIkMcmB|eEXhD<1-@;_d8<#aOZj6xifRme9!wi?>Xnrg)wd~ z54DgU@6fXi$%Qn6^pb@oJzH4RI9ph#dUs0tfSy)O?ggdl3%A}-s#d$b3B}624^}Hw zYo_#pQWZX>FO;f?sePeXO|wLVLKR6|N>!9cKX9~mdVf~CuC*)?MdSBa9`srguiviq z_}`13F#sHeyZ1tAP81I9&LL%+)Zx9kD9w(9%F7Ogar04o>^q$Q^Dr*dRH6RVF`TaY z9#s{^DBl#1{0L7Z_&6fY)0R9~L5yFt5Yv-fyBMm&(dr4Wpy})ha2^eHzazwBgZVi;OI@l{-`t(NsF8q}XW`X5^~tG&Ka zL)~%g&@6_U#wBW6AC|A~yvNS621jcqzs6>}aOx;!@DAn1V|(=I5rp)Q6F==icBmVo zX~R!?ln0fJ3_PU?BY(U7n8VjYU&{SiBJ0ODp@u{=J>p_)Aq z97Vdlj)vOb46T@aEpkg);DWOJSd(oyCvIG6MsY#_v01Y`cH!_OHijbI&14H4j`Do- za?|q~=6AEL1-dYImd7VK;ynj}qbT<`%*gE+QUhI4UhwR>8S=F@)FIK=f#uVXC1K7W zaI|&`v7Khl$(mzGTPWD#^ie$1(U7mYq6o1wERo=4!}2Sb)_dEs6g{;U8qHu!4;q1r z9NS+o2Ku0)@~EX7RgjmA1&ZWk%Hj71|+mbVu7@7|I0;NBfPynh$% z?GN>qrK4dsMkkEkbY36MpZEoFl$|-gIeal5Z<@uHx#RF*>OCpKd}Qxant({+wVrBY3hy0ZR64p zvEGZ;GWqC~72;?0N8I$jbR2*p)m+pbDU&i4bvS$-l=+c;I;bc+j^`v_dvK(hVIEs{ z$cNPb;HTH7@mxR08fqU~94twf^5F6{(C z$`?1TGrLdQBevwZ_Ke#0NcD3@{a=+5 zirl)pfA==ZbP-6TwJhg5Wu7BAS~t7Dd2GwaQ(XsE?L<#2ocM7kYd;b9dp{K=K}~FO zzEkHrf}=!FK3n7IYUHgLPjwwwwbfqMwEtyyx%NG6PKsO)f2~E5_dwa&>Hb5&k$TPm zc5V_|=*LL&b7Ixjkk86JSrD1XJp^0j?o4QW1~FRjGk>tynkctTVUwT@7}|YpI`hrj3YJu=U5Wz*QK%}-MMKR|+@#-F z`aNH)F}Zan&Of|=4||h?Xsn!Ao;L&y14rp|ZP{#MFBkV(;=c5OUiy1ex`r8Y7`~PQ z?B=PJ=Hr(%7dU=Jn~jTj%AmQ_a!!6un&Y(_45L%}n)_%TWCc32J?8|wfFtd^!7Mf- zQ$2j6XA)&jAK8zr04J8$$2^}7M-D?;Kf4#oX2^A|^UVWFNure)38nM5?64P72xnf*o^XOI)~DfAm}Ks+{HYfhAeqY zMu4LY|2v!Ub>PCE2eDV}2VL+m^5@F(*oEUWVq<9I0!Lgr|NQ5qVNPN$-)w8bue&m^ zEpiI&8*j6`nev}cTpVo-d|qtE`RLc?)#h`=l#bmAJ}6lFF7g(;Api4`EN`a#7tr@P z$_{kGm5a4{D?L7nYkLdbGaWB0!2YygY>RNi=4GRa#g*lU<9QQ}5l8t;T<}AFIF9U0 zFw&Fd<4_nn7GEuYADcr)u{>~m8n*dr*(h+eIpkgP@qEPX zvuEwzBQ|Af%kt4sstQ+(hElb4#rsgKLWxbGDq8sgl&WH4Q>wOwje%0NebrbfRsRAt CM^dE# From b2d4fb94d6ca22c8b61fcdbe79d7ff8aa5527545 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Jul 2016 00:34:59 +0200 Subject: [PATCH 141/144] Fix wrapping of left menu for menu titles --- htdocs/theme/eldy/style.css.php | 4 +++- htdocs/theme/md/style.css.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ae8d0e98738..ef75f3032cb 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1058,6 +1058,8 @@ div.tmenucenter div.menu_titre { padding-top: 4px; padding-bottom: 4px; + overflow: hidden; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1421,7 +1423,7 @@ div.vmenu, td.vmenu { .companylogo { } .searchform { padding-top: 4px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:px; font-family: ; text-align: ; font-weight: bold; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index f4e7fe8342a..9e217efb30c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1087,6 +1087,8 @@ div.tmenucenter } div.menu_titre { padding-bottom: 2px; + overflow: hidden; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1458,7 +1460,7 @@ div.vmenu, td.vmenu { .companylogo { padding-top: 4px; } .searchform { padding-top: 8px; } -a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:px; font-family: ; text-align: ; font-weight: bold; } +a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } a.vmenu:link, a.vmenu:visited { color: #; } From f756f3db0e775d562d7159b90925b15d2031bff8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Jul 2016 01:23:20 +0200 Subject: [PATCH 142/144] Fix hook context 'all' --- dev/skeletons/modMyModule.class.php | 2 +- htdocs/core/class/hookmanager.class.php | 3 +-- htdocs/langs/fr_FR/admin.lang | 10 +++++----- htdocs/langs/fr_FR/bills.lang | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 09c416a7fd2..22432433334 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -90,7 +90,7 @@ class modMyModule extends DolibarrModules // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file // 'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages - // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module + // 'hooks' => array('hookcontext1','hookcontext2',...) // Set here all hooks context managed by module. You can also set hook context 'all' // 'dir' => array('output' => 'othermodulename'), // To force the default directories names // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module // ); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index f4f9a37fcf6..1a7425b0a55 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -87,8 +87,7 @@ class HookManager { if (is_array($hooks)) $arrayhooks=$hooks; // New system else $arrayhooks=explode(':',$hooks); // Old system (for backward compatibility) - - if (in_array($context,$arrayhooks)) // We instantiate action class only if hook is required + if (in_array($context,$arrayhooks) || in_array('all',$arrayhooks)) // We instantiate action class only if hook is required { $path = '/'.$module.'/class/'; $actionfile = 'actions_'.$module.'.class.php'; diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 205c1e0eccb..767b138eb54 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -383,7 +383,7 @@ ShowDetailsInPDFPageFoot=Ajout de plus d'informations dans le pied de page de vo NoDetails=Pas plus de détails dans le pied-de-page DisplayCompanyInfo=Afficher l'adresse de la société DisplayCompanyInfoAndManagers=Afficher les noms des sociétés et des supérieurs hiérarchiques -EnableAndSetupModuleCron=If you want to have this recurring invoice beeing generated automatically, module *%s* must be enabled and correctly setup. Otherwise, generation of invoices must be done manually from this template with button *Create*. Note that even if you enabled automatic generation, you can still safely launch manual generation. Duplicates generation for same period are not possible. +EnableAndSetupModuleCron=Si vous voulez avoir cette facture récurrente générée automatiquement, le module *%s* doit être activé et correctement configuré. Dans le cas contraire, la génération des factures doit être effectuée manuellement à partir de ce modèle avec le bouton *Créer*. Notez que même si vous avez activé la génération automatique, vous pouvez toujours lancer en toute sécurité la génération manuelle. La génération en double sur une même période n'est pas possibles. # Modules Module0Name=Utilisateurs & groupes @@ -550,7 +550,7 @@ Permission32=Créer/modifier les produits Permission34=Supprimer les produits Permission36=Voir/gérer les produits cachés 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) +Permission41=Consulter 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 @@ -593,7 +593,7 @@ Permission121=Consulter les tiers (sociétés) liés à l'utilisateur Permission122=Créer/modifier les tiers (sociétés) liés à l'utilisateur Permission125=Supprimer les tiers (sociétés) liés à l'utilisateur Permission126=Exporter les tiers (sociétés) -Permission141=Consulter les projets et tâches (y compris privés dont je ne suis pas contact) +Permission141=Consulter tous les projets et tâches (y compris privés dont je ne suis pas contact) Permission142=Créer/modifier tous les projets et tâches (y compris privés dont je ne suis pas contact) Permission144=Supprimer les projets et tâches (y compris privés dont je ne suis pas contact) Permission146=Consulter les fournisseurs @@ -1585,6 +1585,6 @@ AddOtherPagesOrServices=Ajout d'autres pages ou services AddModels=Ajout de modèles de document ou de numérotation AddSubstitutions=Ajout de valeurs de substitution DetectionNotPossible=Détection impossible -UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access) +UrlToGetKeyToUseAPIs=Url pour obtenir le jeton pour utiliser l'API (une fois le jeton reçu, il est enregistré dans la table des utilisateurs de la base de données et sera vérifié à chaque accès) ListOfAvailableAPIs=Liste des APIs disponibles -activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise +activateModuleDependNotSatisfied=Le module "%s" dépend du module "%s" qui est manquant, aussi le module "%1$s" peut ne pas fonctionner correctement. Merci d'installer le module "%2$s" ou désactiver le module "%1$s" si vous ne souhaitez pas avoir de mauvaise surprise diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 4aa648459d1..6ca57901e9e 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -467,7 +467,7 @@ InvoiceSituationLast=Dernière facture PDFCrevetteSituationNumber=Situation N°%s PDFCrevetteSituationInvoiceLineDecompte=Facture de situation - Déompte PDFCrevetteSituationInvoiceTitle=Facture de situation -PDFCrevetteSituationInvoiceLine=Situation N°%s : Inv. N°%s on %s +PDFCrevetteSituationInvoiceLine=Situation N°%s : Fact. N°%s sur %s TotalSituationInvoice=Total situation invoiceLineProgressError=L'avancement d'une ligne de facture ne peut pas être supérieure ou égale à la ligne de facture suivante. updatePriceNextInvoiceErrorUpdateline=Erreur: mise à jour du prix sur la ligne de facture : %s From 804159f3f3cc884cdff55e580d61198ec5cb9106 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Jul 2016 04:11:27 +0200 Subject: [PATCH 143/144] Fix language files --- htdocs/langs/en_US/languages.lang | 1 - htdocs/langs/en_US/link.lang | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index bda34ce2299..884f9048666 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -1,5 +1,4 @@ # Dolibarr language file - Source file is en_US - languages - Language_ar_AR=Arabic Language_ar_SA=Arabic Language_bn_BD=Bengali diff --git a/htdocs/langs/en_US/link.lang b/htdocs/langs/en_US/link.lang index 6880d4d86a0..77a1814f1ca 100644 --- a/htdocs/langs/en_US/link.lang +++ b/htdocs/langs/en_US/link.lang @@ -1,3 +1,4 @@ +# Dolibarr language file - Source file is en_US - languages LinkANewFile=Link a new file/document LinkedFiles=Linked files and documents NoLinkFound=No registered links From 63ad970a27c932b2b32c9b94dedc3aff16684e69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Jul 2016 04:26:22 +0200 Subject: [PATCH 144/144] Sync transifex --- .tx/config | 2 +- htdocs/langs/fr_FR/interventions.lang | 2 ++ htdocs/langs/fr_FR/languages.lang | 1 - htdocs/langs/fr_FR/loan.lang | 4 ++-- htdocs/langs/fr_FR/oauth.lang | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.tx/config b/.tx/config index c4ec45cd3b2..010227f6e61 100644 --- a/.tx/config +++ b/.tx/config @@ -170,7 +170,7 @@ source_file = htdocs/langs/en_US/interventions.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.languages] +[dolibarr.languages-not-res] file_filter = htdocs/langs//languages.lang source_file = htdocs/langs/en_US/languages.lang source_lang = en_US diff --git a/htdocs/langs/fr_FR/interventions.lang b/htdocs/langs/fr_FR/interventions.lang index a2803463899..d9c51beab73 100644 --- a/htdocs/langs/fr_FR/interventions.lang +++ b/htdocs/langs/fr_FR/interventions.lang @@ -14,10 +14,12 @@ DeleteIntervention=Supprimer intervention ValidateIntervention=Valider intervention ModifyIntervention=Modifier intervention DeleteInterventionLine=Supprimer ligne d'intervention +CloneIntervention=Clone intervention ConfirmDeleteIntervention=Êtes-vous sûr de vouloir effacer cette intervention ? ConfirmValidateIntervention=Êtes-vous sûr de vouloir valider cette intervention sous la référence %s ? ConfirmModifyIntervention=Êtes-vous sûr de vouloir modifier cette intervention ? ConfirmDeleteInterventionLine=Êtes-vous sûr de vouloir effacer cette ligne ? +ConfirmCloneIntervention=Are you sure you want to clone this intervention ? NameAndSignatureOfInternalContact=Nom et signature de l'intervenant : NameAndSignatureOfExternalContact=Nom et signature du client : DocumentModelStandard=Modèle de fiche d'intervention standard diff --git a/htdocs/langs/fr_FR/languages.lang b/htdocs/langs/fr_FR/languages.lang index dd730bd73a2..6c3f24877c7 100644 --- a/htdocs/langs/fr_FR/languages.lang +++ b/htdocs/langs/fr_FR/languages.lang @@ -1,5 +1,4 @@ # Dolibarr language file - Source file is en_US - languages - Language_ar_AR=Arabe Language_ar_SA=Arabe Language_bn_BD=Bengalais diff --git a/htdocs/langs/fr_FR/loan.lang b/htdocs/langs/fr_FR/loan.lang index 481c9ba7b18..6fb63229485 100644 --- a/htdocs/langs/fr_FR/loan.lang +++ b/htdocs/langs/fr_FR/loan.lang @@ -31,9 +31,9 @@ DownPaymentDesc=L'acompte = Le prix de la maison multiplié par le pource InterestRateDesc=Le taux d'intérêt = Le pourcentage annuel d'intérêt divisé par 100. MonthlyFactorDesc=The monthly factor = The result of the following formula MonthlyInterestRateDesc=Le taux d'intérêt mensuel = Le taux annuel d'intérêt divisé par 12 (pour les 12 mois de l'année) -MonthTermDesc=The month term of the loan in months = The number of years you've taken the loan out for times 12 +MonthTermDesc=Le terme en mois du prêt en mois = Le nombre d'années que vous avez pris pour le prêt multiplié par 12 MonthlyPaymentDesc=Le paiement mensuel est déterminé en utilisant la formule suivante -AmortizationPaymentDesc=The amortization breaks down how much of your monthly payment goes towards the bank's interest, and how much goes into paying off the principal of your loan. +AmortizationPaymentDesc=L' amortissement décompose votre paiement mensuel entre l'intérêt de la banque et le remboursement du principal de votre prêt. AmountFinanced=Montant financé AmortizationMonthlyPaymentOverYears=Amortissement pour paiement mensuel : %s sur %s ans Totalsforyear=Total pour l'année diff --git a/htdocs/langs/fr_FR/oauth.lang b/htdocs/langs/fr_FR/oauth.lang index c0cbb9a370c..24a654f21ac 100644 --- a/htdocs/langs/fr_FR/oauth.lang +++ b/htdocs/langs/fr_FR/oauth.lang @@ -12,3 +12,4 @@ ListOfSupportedOauthProviders=Saisissez ici le crédit fourni par votre fourniss OAUTH_GOOGLE_NAME=API Google OAUTH_GOOGLE_ID=ID API Google OAUTH_GOOGLE_SECRET=API Google Secrète +OAUTH_GOOGLE_DESC=Allez sur cette page puis Identitifaction pour créer des informations d'identification OAuth
'.$langs->trans("MailTopic").'
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; + print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; foreach($object->substitutionarray as $key => $val) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d09be0897c3..cc5b16f1935 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -183,30 +183,30 @@ if ($object->fetch($id) >= 0) $linkback = ''.$langs->trans("BackToList").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); + print '
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print '
'; + print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; $nbemail = ($object->nbemail?$object->nbemail:'0'); - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && ($conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail,$text,1,'warning'); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index d9cc6f31d23..298ceb886b9 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -41,6 +41,8 @@ class Mailing extends CommonObject var $bgcolor; var $bgimage; + var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely + var $email_from; var $email_replyto; var $email_errorsto; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 92a41209ba4..54053c26606 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.0-beta'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.0-rc'); if (! defined('EURO')) define('EURO',chr(128)); From 16e3a3d2945cc32705763d71bc13f3843c57b8a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 22:49:08 +0200 Subject: [PATCH 138/144] Fix datadir not defined Fix can't use the cron script on cloud services since the admin user may have different values. --- build/exe/doliwamp/doliwamp.iss | 1 + scripts/cron/cron_run_jobs.php | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 8b368fa3b8f..c82b7b40c47 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -314,6 +314,7 @@ function NextButtonClick(CurPageID: Integer): Boolean; var myResult: Integer; var res: Boolean; var paramok: Boolean; +var datadir: String; var exedirold: String; var exedirnew: String; var themessage: String; diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index df755a50b64..38054c48c69 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -80,6 +80,23 @@ if ($key != $conf->global->CRON_KEY) exit(-1); } +// If param userlogin is reserved word 'firstadmin' +if ($userlogin == 'firstadmin') +{ + $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 ORDER BY entity LIMIT 1'; + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + if ($obj) + { + $userlogin = $obj->login; + echo "First admin user found is login '".$userlogin."'\n
"; + } + } + else dol_print_error($db); +} + // Check user login $user=new User($db); $result=$user->fetch('',$userlogin); @@ -93,8 +110,8 @@ else { if (empty($user->id)) { - echo " User user login: ".$userlogin." do not exists"; - dol_syslog(" User user login:".$userlogin." do not exists", LOG_ERR); + echo "User user login: ".$userlogin." does not exists"; + dol_syslog("User user login:".$userlogin." does not exists", LOG_ERR); exit(-1); } } @@ -178,7 +195,7 @@ function usage($path,$script_file) { global $conf; - print "Usage: ".$script_file." securitykey userlogin [cronjobid]\n"; + print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid]\n"; print "The script return 0 when everything worked successfully.\n"; print "\n"; print "On Linux system, you can have cron jobs ran automatically by adding an entry into cron.\n"; From d7bc30fc4e791ea65fa826f34ad45c097797c942 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2016 23:18:01 +0200 Subject: [PATCH 139/144] Prepare DoliWamp 4.0 --- build/exe/doliwamp/doliwamp.bmp | Bin 52574 -> 52574 bytes htdocs/public/demo/index.php | 4 ++-- htdocs/theme/eldy/style.css.php | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.bmp b/build/exe/doliwamp/doliwamp.bmp index 52b1320d1113e36e744c5ebb2f1aaa5b397e5b0f..3414e100306f6d2d2c1866ac9daa8ba1bc63dc18 100644 GIT binary patch literal 52574 zcmeHO4Nw$kntnA{-tL*C5-L{Qt#a`S%B_lFuS`{{&Qo)BN!&`@4Mk2byWEO27{ss(h8o*fmTX?rL58f$x4NS!w zz*1y@Eyi`Q{`IfGY}x?tmXyP*YguU6ydK^*nPAiAKSSA{--ZI?UMMU#!MfiuVBNeG zwr?qh58wSC_*MD)u*tj)_EzX&@AmbuyD|@sR{RmRo2y{^duFJ5?=P_By?5b%-`ft= zAG`%s@4o|YZQBbao4eqXkBXtSvIO4S`5}0!e*=YXVr)B=Z|*7o~m822L*xgzS&M!WN-N#Nr=a&cJMDv$$>UcdI|H2L@jyFP`vk{IR{{mbm?9krY0L~N5 z(DY>+Tyxe!(}@;nIMD_>Th79lCr*Lm%d^ng@&z1pw!`VxHfTB73eBx&p!wt}=s0x@ zI!+&f)2B{=>-14z&eXy2lRePsJ_^TOF4*Vlh7a96(B*E04)-Z&adkpR#|daX^A)(< zUxVwbcKG_tSvddoaX8oEf|F-@;AF>Hs5pBGzUb(Icg_vKH=Qo%?mPo$JJG+h3oiDY zgs;z?hxT*dfTyzu&Uc@MzOGKV)bkaTc?Y1c_cV0$_@Li=7QXR#;exjd&U(FY#d{vk zdwp>J8`Lj!g0J@?_%3*$>(WK&@9Tt~3)jH!>jnR%J_ugA1Q#w{hKqfdAlQE%uJm7k zt5-1Q6+hg#><2n<2`*o`4#BJa5DH#_K=3N`UB3=DZ(M`xH$pHxH~^tR3PLx+aCLA5 z*zgUw`7Hw@VHTJ$2j314!N}iuVNBpP(HPJe&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad z&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad z&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=}Ad&=~mt#{f6X zsbn}RrOFsfMbbDY-`6)dI6O3{FgV!K-KV5vt*w=^)9sj~+k09&>+4*0o?=)zJE8KJ z@9Ub1hWze|{F?l4pF1S_3=M_)2J!dmQ1mq{5n|$ap5uAoyN_P&<`;^P25M^Zj+W)WP*%|`8l>Y-JdbTyP7~9(nhJ-zrUNlYB-C&{4{yGrX2W^OM9w|_fQJsC5_I`JT@Fvc%QNHgC>1Z92`5BC zsyY)b;*moFB_BfJFwft(fmxhou&kz`##eJqfitkPwdHC>UrS%#kYePx`d@qWhjY+U zTVm21%8ey@-p|tNLgI8L~10*4tdC_!darOa&(TWVsIf^p?Vv*R zxwa5PGeLidW&#L{VQGf(F(Spv-6zy2mLcU8wB*;cVB5>zRF)qJ-B;FGwz*afd+GjpX^Xyd|GN9L?zwAT+CAy)xUE@mpsWGc*!@~P zEX3-{Sf^;QKA6T^psAqOMbVVUbv=lq0nO5sKQcHZY{gMVZ2n2rwckejEgqNE&e<%y z+3pWG0-W7X+byis!aAI+!xr#bow39+9!btgN^)m!Y{W6r0fr6-LKNi9osn+SPol&HBo-?xxf2j?-nu#V+^hww7aU z?!!W+avDngEsX^$xm8)aloAvd(xw49+RjH+$N z1ROItIgGqTAFRyMmu!4`aHGyxS8&*<*Xa`XvtR|W^B-KsnQ%-bqi0SMqn8QnaC%&> zbAv9A$Kh&ndAy!M6-|mNVjTVe7axiwK4)A*xew!e7BBn`V#F3yASHIX9kUo|V zlA_eBVO7yBf_{wnshz#=e?y$4B01 z;V6m;2)|UA3gAyWMGaC6jb>Us5Qg0X&eKDCUKH3)ib3KWup05^#NS|PDXA_ofi+0# zQOb<#GkSB+(p*Eqs&%<*vvax%mKh8if2S*`d8>DA;l|v8W`#bE%@@Ya(yONzVzfz# z!egX^5_Cc&augG6e7_dz6{{8nRiTc>lnR}wl5CVP$KALM7{z;>C`P$8CZSAL>$9QhxxNHA(BZ3R~oi#(^qcnE!LTe*O=SZ zG#X5A{A-6vXWmh0Fq#vFN;t}lYfKPo7)L(wUdjHeB&t3qs#3-%=Qw{tUQ-k23-%5K zSPEBVw2!07@{DXK$4MweOv3?uIgntgq^#xDc8{aW*;8rll>txz9|=dcZ2Ln2zpsvH z18Br?aDswm^%Mp76&2^`gGO^f(Yl-gqsdfQv@Q-H&Q)b)#LBp$OD|lWnZD?r)@;{Aw!LuEi|pf)_X%WT!Q%0uEV2Yo0FmPc z#Yb8iGoyJ_CaUP`5Ua5F9VVk18zu+*At@ZGN4qFG1OgK77=cO|n3mK8XE86b6i|^h znu=SKPRFf^9itrCI8tZv^tb|{bN+#k_cgZnUvfEBja~tOb0LxEho1Q!K6k|k74URX zJybJpipdva^xGuXV41~cv2WXEsWaQ!D;ryPSZ#7K>M~dnMcG&H5 zRr3U+RNNLxk>;{sB!;keMCTH=B$v2z*u)2@O99$DL`Dc49&l@jVI5?o5K;F6PKV3sbj8Gr+Tjp*j5xT+=s|RXkto54LBNP_qsGFBvrNvS+?*9pGug+M z=B!<`ih3+ND`)Ah6)RUQ%3LZ^C*lmZ2{*UyY<8Q=ZjUTcTwS)6yPsWFsB6ku zn&rdt1Q9USat4dZV6fS&W`o^qw6k6dWigsf76WTCS}b~otJ!I>TlF>zx{o5*4g$hG zuy}inbho08+jt6%YK`Un&VbWzZ?uY0=`cmnL52?CYc^UQ6ok6AbND`urtp0Qp2!P0 z%7t&eNfnWowlt3A6{m0#Mi+tRQBY38j89GhkIz(T*N=Yl*po0a_BC-5!xOnn@~V_r zh=>^xJDx@b(z9!%vE0yn(%aK%?RC-Cs&v#8Fpgs_U_tc3ArxyXx#tbG6br zl_Gg@4BvV|#wg`+fp9w?YL$}GS*U9ftm2}hzm6oO;pVisYskw_0{x8<@6pGj zh{Nco_-Y{(kc9#xw??6^WkH`0&5|N1C}HXT|0S7CaFi*?vCYC$B~E4IhIiKgDrq!nLC(;KS~U?^Nw}vY{9V zcqy7=f{f2*4|vGhGC;XJB9FoHaHW2oVVlWx)?m!FFh#rbcA51>oiVsD85Z{ThM&Ls z-1lOiuW?vpA`?dpkL*Uy<#E~UIGVbg9;Xvu5OURw(`m&P<>A;K%HnZY9Uh0zVR71N zuD{&rayV>GtIz4OyBu~ABj*e^QdXbG7i0p?UJvV`{a(CZvPz5*X%Ap1d`JaEppE6d zR4>K&y*~UXB;4!kA>Bpj*Blko6RR$rQQ^w9Iiw*Hpy~o8U1gM1`AqIDPJ%(64PVEW9K_ck z7|~83s>cq z|Dvd{K)0-9)xn}dgD$&J4kRgK?(I>5UTot5hsUn8Rf3URe2hGUsW84QSA&Ex{QF2D zi7^V(dBkI!Q@4;W)L^tHu5r`N&1uzUQ(>0gAm>RK1%nDBLT81B5TRMVV6+MnS36_^ zO-585BEnY>EvWcDf8YUADo#JfPR>jaj-J9EbcKm(F0+uW%R*I{hg7 zK~1$dhBf2#-oyrQ_D2PUi5)aab7#eO9|@kXA6}Z7wkm7h#^uUXgP+=oOxQ5(U?6`wzu1_#h$x?&v8Zz!fp}5UcQI885tb7BP~hBEn^@ ztig4~;|$}Dk>3??euHP63$53?=p&}6CEAF%|F{(wDPj;3Ll81KQ9Ql@W9XeiWYJ78 z`d08ZlfguB?go#`Xu^jBvxjeJXt!H*W}~H;r`_FFqtU1{SSUtkwHb6ai_z%eZ=7}7 zi!BzXNd&6gx1c4g<73f%F*r??Cxv;8!%&Md}zR5j{jy4<->jw`IOd2o+C&D#7Pia=`cx=p9CTp zaUC7JF|mDI!T~FM+CaL7(hV`Z)XhjKiY{sRKoPl2oRS0ObY+3fU^bX?>k785FDNY1 zHR}BZh9W~O&Y<}0`uJe{+Dxq5*rUK>f_qKQM55ZmJ8+^64g{|B;5u}8ByjF}(@@(0 z9gGb{i{s<-SHpXh`V??IhI@-?f6T;v#weJGQQ8N^7Cu?Qek)Tg6Ft5X+a4))0DnSk zFshG{G5kp8qUC8z7cC!@z$SkteBe_xsT79A1{p;|TtZx%jqryKO}IUF<=S=C2CGBd z^+;w#Ap0Vyv>n01qV@XR;-BPZ8Pwxf9K^`@Sjrz?81wB+lhL+DT3x9w!&{dmw%sI= z#t@#!SdK&JI5hHZp+w}6e6y{V$981dO4J5XM~t{7bc^D^DC4)jI1g?(YW|4_7qO^# z9Mxw+85K1g<04ySm8|DF8CXXZR@{@iIQ-ng_`T*tW!*N6AAQtcR#c=nA5nOP;1tEJd#!+E? zs<`o%s4*i(XUUqixrX)j5@ShL$r?jlTqSLM+N3jPn+%n0Mr#(8o!uViArz&M5|ibaZI7-mx$gD`){UVi&TCPv+J~`$$9OkM6qbZ*2q| zX@#Ou&_-zo6E|bXTOPn7q&@iP8-H^-moG}2m-(Hn<$@70;)mzADm2gBY6x805ea{1 z)ruMA)Ehr~rSw_pF&Z)6QNq4**TWAU>wmWG*;4t-8pO!zoN-@0-Co@CW-dpT4RV*j z=AkqvdFlSjqdhT?5Qx$5v}E)AOKaBrHuTa<>+5bWJRutE(XTNtf1^;}lv9aOqu&_1?-{i@YpVX6uV(epM zVgI7vt~Z>{RInB=gi7jkdd)q z&Vuv>3o_=+$yoNt%zsMFm@_jYeL+U*%zM+*Qy0vclbV5-pe;2$BNY>P1tv06@#>kk zAafpBHZ$XqnG2T9;YpM^_uhe$>dUxy_3C?9Z%E~lgnLs{Ggjvzp{a|X+CWYjtI6@c zr&c3Dm=IFS7B5CUZy6p?LF-c_bM=O&@Q8MjxKHpWX(AcKbZdf*hXmj=+%2i8b2Ao~ zWz3yB_dYi{&b_aJ92Z|%Oj3(m+$5DzgNcmAtLM($oc9!_TUtnFY91Qq&V8zZTybAn z!+q$JC*GcT|3H+lTr)r;r;AR{AVG5*PtCu^vz{;7}>99GM2i)Bsm zjWQ*2P+TXb{j=aUt>c_ln8tv{fX0BvfX0BvfX0BvfX0BvfX0BvfX0BvfWkn^oQrv;l-NJ5M)aXj+;WtC^j-);SPM#9aXN`R5ytOhB&PKTl@cpQwpy0)hSnp}no zV~1=+9*2g8ly7gvjH4=F*>yS;Rk>=6ch8^y&=YTe9rb#}V+l-aVR zD9?qb?oNrAaiURBT%RwQXDh~O&}4|SRTw+&mLV=t{X6A(#d#W#DMcv7sxTstqCBu! z1(C0iX}kk?yu9QglqLD6t|{XV4&e{oNf>!t;o=%s4G@_>uRy#5cvPB#T6;)o7k4T~ zRcoAmhhn@e^>u+wHNR7?EA^-9*9l6!Hec~XErG|>nUs>p#CTcV7^fTK-Li~@@#y^7 zvY((#9cc+7D@BivF_iy648*$=M4CF&_!uwe&%Zks;@=D7?DO$V40Yr`^nh|3iWcuW zg%+jQ*-L&FB~LC%3{SXX3K7MJRxl=|#Rr-~OH#-b=P5)KA6h9kDJ?$G6k3u(rZ`U_ zqWI8Cu}Nw1fu_)s6f(tm3K7MJR*FqZiw`t~mZXp=&QpjeKD1J7Qd)eVDYPVoOmUt< qL|SN#0gVBT0gVBT0gVBT0gVBT0gVBT0gVBT0gVBT0gVBPf&T;W9sM}~ literal 52574 zcmeHvdvsgXneU!;FTFDicV;bSx>jjJZ!+{@*4Tj?r>x5)^<&x!LSkIs+IOa@JxmK7 zM~#V*Wk?i=>>>rQkz2=h9m@g5F$%JCWXB1yfEYazOoC+;#gHHy3k9%jH)4yZ$p{S#VkL`@273>`&OA za(dPXW4V7Wejri+Gv57Omi?XYu&3_7hixhT346Bm+w4a_EM=QYo@V?0=^pm0e=cJW z{mW0;&$j)99jGj0+MoS|S*l9dw(V-R>ydwC?GKl;j-P2*wdP^g@Q9j~)$U}6AN?n0 zseOn&{rCgyajk(pwyT!?@DVfn`R*F_tuMSF4Ft zKeoW6reCqnHY4k5e}X;O`W)NaVrD%ZI@Z&vWrq)KW2ZXwth1$?b?$Fr-TU{kw*Bqw zm-{=J?fEBJ_jAv(C(S+Vsip~b`~@Q$IrJ3Uf3S-MZ9CX5%Td|l2n`^5`~*^Av)cHsF}*{@!(F-vzZ;yB2je(p_XY!9*XJ&o*{!-&In zi0wJ@B0Jh^W)@oyJ9y{}dq?^eGrcgv9vSjZa~`)aNB>cF;DnX+^}od2C(O(?aEzTea+-AyIN0Ec z9yT<1m^ohRX9F)CW5d z>G^r~uOI)0&3_zc%gH$wPbOIW<1~vVudt=`$LwGKZGl}$FR_L6C+y#r7ul8neU-Nf zSCvaaKtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3 zKtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3 zKtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3 zKtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3KtVu3 zKtVu3KtVu3KtbUDYXnRW{ZOr~sM1zdRH-Za98Wg(JB~a%WO{7Znf(u*aTw~ILytZ) zWHX=WZyoB}-*m`fH1;9f;p{eT*;1vhQq|x4_f=JDRsHw#wOVz4Yej`tU6p6ukXJ!r z-@ikpt|~D+bjJ_CTCw~4->*<>i|aRRpuldY)75ii*y(V-?i)Sx{44J~?|i6dRPs4& z&fSk#U$5vJ9d(V4`lxUYt^M&Gx8$t8`R1I}Ii;?C{oj@E-+%8jtN-K%>zBXqxbDHf zvg*Ek$I!YjnjgLQ(Vjc*{e`r*%yIAi&p3yyzOpYGOS?5^z*cHd_r3U&2P@jN!w=ru z{ivbBrMhdKwpG`6{}=9m$k1l`=P!Kg(W+M6i}!!?8EtFD=!uV>R<~-p-5%!;?|)Fe zHD8^ledNbaJpTB%{?nKK=SE{icKuzqeE-LPQLn1dmTE>x#uIn^_(v6`nznj_pHhl%+w6O{_toF~;IOm*b@Qz@ zgF`#?h34*?Ej0LJATyGU!`lU zFmM?s&Ybg2&^6~VoTCV~diu`6+wDUMPF%D(tX8Yd zWbL+DZB~n^)w=(e-L2hLQ-2%$wl-@&tZr++gK!-7A^LN^QCPS~edjLXM>i}lEc`fu z+`dt8%KnKARj{vw@VL(L&iir-eSV%cM`KW}&R3aowArfCe47(>V~88DKkXC*$B=U+ zc*yA>9tTl4S-dGT4D~<#t^Gayt@V#OUvGW<{+IjjTYsOc&01C8YHI5TU?!8PwclYf zwdqXtR+rUQ-)Pmg8VpWe)~2d9ZN0X&wO^PHt>IZ~tM0JYV5sVs1%xF(Wbt3dPd;%A zdM2D~9_APpFFS3H2Oo6wcWWPYxVn$*AMM`u?Omg#s=U>!@5zX(UGjbC<~4bP{pJ|fVs|5N1O_GDh{`>mi%2m+ioo5cm&Y6D6( z2eCTM&_)v+@NqFfuytE(-QdlLGfXlrCDV)P91fcQy|BJU;-znaZBWd`*{p-aY*Dyxr}&|>jFm;%CrCx z1@IhE76cqPb@Cm@=`+ta1df zxFYeg);BcNR2J0~<<@K}DzB;0>$lTW)39BS#AFFF(Olp72paM5#L@0#Za73fC?r!+ zxSMMxXc_y{l3$BU(CL*WUauQEj@J|w=4R!VuP-Pp*xs~P-}G=(15A>Uk|h&mf;#A)4VPhRMt&RO$|-k8*18{^zFFd zsVLUSk|9X}l&E{6MbC(zL0ja9mrO<-xIR|yY==s=x9@1`92^)t zrGf&4B9Vnaf->;CuVo^~t}eU%DKIxm_Bav3@W@xxR~arg z?@?sM5xOh$$)(Qgb;F*9h9?^uAm@`X4v~yuQ;SL6BE=$!NHms+#O83%%fG}N$oNHl zLAxgsu(-_zV>lQwn-Y-#ar*6QqtRy9v_v4Is#sehbdrRk=8+=@gZEqnn0PW|!F;Vn zf}oV`fjM!_&&|z$*mY6`V)%e$Z!~-3snqX#5D@TNS`tCG`Lx9z2`wCO#}k2tR4OIe z>TI@?Hlv$xRLxB4W>D1>l{Lv_JOw$a@bFt+IBq8#m#;4W zk%xl$Pv-lC>`#_ww;GGn9a9^6xJ4~~$G|KV#nv6MpHMumtkAkTr~naFNARW7H{NV!8nWx6IAxP*MNh@$Z! zlZ4Uh>-1S!>o;Ys&n?)Y@8B{5l}`vw+*gDRuXuQUL7B!=iHs`1rc%ECLKw*?eOqe z2HQ__8OO}M9&@kxpt)D-l>$P_j5&k1=IO;hd@Z9TLY;~121;^ekQGs`-130pdLU)d zGPr^tp_I%Z8B~J!C68N3#wDq&%)HIKu58;jqj672KpD#j3BDM;^M|ixw3*Pyn1NCv zA@PtrbaOv>MYqbmD?Bng?}li6NXZQTYjR;RxqwnwSp4;CBl&?j&jNZEMDw1jD~}BlS_X+ zM@CGp!X!4tLA~Doy_$le^;zo+atrj^yLegqo1urzX7iqAv(Yd0`kEypTnCN3)IS@J zysTAWw2v4Q$;0RL5|@cenEwdkG=+0TAce?`sfdGzCXw3Js}1c%P3W$h=xJ&g;B_WE zhtj3zaz+WSv+>qv(8sG(*2Ob3bzyX4({p5o=cgm&n2t=tLj(%K6^>3%N21|qgu*f* z({r2+(Lf*3K`f#PpVqC_KqpuEj3?3Y4#zdyGi}!`; zk#+xKT*n(5YRyp?(^RkJX8beiBX1uCjxuaQD&F|ON&2>k5q=sEiOEAb#1ulUCuJ_h zn~<)ijNNS0ji%1nZ7$cZK zAT#PaA@#=6%a~FS`AU-J7T}{PL>xb%kL}I-nmU`?+xO9IX5VpMuSd3(8O!jjGk?8o zTUm2i*|v2D%GQ0`%!Nez7}m9@&7Tp+beuPZF&en0QdFdTigP7~l?O=a51pu8j;2v< zs0Jm|aWaI5G8gAf$c`PA_V~N;YB1#ho%p1sz{+0`TG^Q{h zDXIi8Gx$USEN^ZINZ;g%S`tWzw3v=k5?n-H_@d4I#-<; zEtlJ9F`M0HNiv(IT8|`2o>~u_lDW3_XIqRevt%X$$VSj87?*jatOpJb4AAdj*TB(% zfmid;{4KLv_p-0v!yfp2McrGrXB`^WF?950x30sxLLbA@F*90aQpRZ7bD~Fz#eAsC zv9S|9wPUeqkH;TFE7{|Tg+T^_XpEp}s8rKXP*G>}JM=qt*654$dVS4KJ)h4kzYtxX zOux7H^TIeLz3J(dqP>`67@JAPY{M3{XbyP=K-=v3sK*>78K={s6Vkd`XgyU7zpvIG z4f}d(Ln*365E1o_H-QH3$Z@;$dMpMCs2HugD%JUw=D zOzKUVo11%$+fdvAmGrEdH*?gckT7YFug9F8p7hm*W55eCQY)E?`Fy}J>G$~KDgQLd zNJ9;JMT{x*<>&&-+p!+iRoN-GkL=d5|Nc%d`<(hX?HRk0439};W7ECUV}zs1X((Aj zYXVd_DCs!K7>oG{#{f(Z73y*zAEc$SvRiw%36}~ z>VLgw>`xz{vd$#?x$J5T?8??*VvMrhtxhBsFj7dPUZZZHJ4PQJGn-7|=p@Gx{&*sd zETHCtEh##1>VXy#z*Qcb4PXU;u0bq64!%WgkKDff$0X!$i&q1xAyY{z#ur(lFfnL^ z7#JQxMdL9)$ryz&G?qjtwN5a3+XH!{>3MYVqV3tabH@(+aPO?#xpN=K@pHlU`5YEL#Ss#g<*5{ZptdWdDYi$%eraR zn!L{?;~zmfpi-4+X;emXka(ny)C^HAN`-g@<^*|U#5LB>WfaPbu_o8Y%1xUp^-YyK zH|^Y6v$Jwvw!zqFY&5|z7-hp`-2IfX5melu!ezn(4=izmgA)+S>F^RqX=fBVX(v79zvbQW=l~F=dWJvZ12QO0Yh*y+6UEnd3hV@R&68~ znH$O6xIxf1=8=PVh-m}oAOa^6pSV>U$x+hMs9EG`^Riw9q!5xfgz30wdmv0YNekiE zwV<^aOh@9B7kSRLV`pV~d1XyyO#{Z^?F04}UvPGEHW-?m4TNSVLqV_IZnM*6#?N-l zc8Gfb~M) zO_0wOcwdh-V`&cKye~)4uK=g+goZ+n#_&1r_k|0E5#VMYjAL|9Y21Z za+~blP;fRd6Z9vRaHai?9=8V%zrC`}eHr3)HV=25#_c5ow*hSmAi}H_O$(NHaS4+* zNx~UL`$%mMwLY=iH{RzrJ!PuXxJf4x97hbmY1@M~KClCF-0jv;MQDM}KgBDA$Lsgv zkqvUtecngUzaw(5@BF9O8__IM)lQ}+Jps2z!pm;S1Awa~m&fn%PR=3_Z6uVEpiHLM z*6v=CESg;F;nB;K6 z4I2fF9}y&qNwOQnW*d~ojOL;R)!tU3)))<2&1$u&r38C9e8@qK6R+3F+q1VUv{)p& z*+aV~3AryUUxOYyw;VHuu7TIQ{)wXpT72gxI{vO`#P6Rt4_y2~zu)cmdxODX0B&yp zlo7x0{CR|if}!AK5DdQar%&3?Pxzafy8M1{O`P{nz^+?48zF`jsc0k=P9(!9Sv2mk zbTmX5V();Gw0y6d(5t9+y=S!|{RRr$*1a_xQHj{r}c0tBEiKS z#QGy<)<~a^yvWU~FNQTVjDP8y9CV~dC0Npc)(uzQU~TrA_(VEcNX zH|X7*x6zGu=N|{=rM4;GEc7QB_Db%6X;E5=m_scy;b3U{JzcX8|Lwqei_UCO8yAp^ z!0cd0)4Q|bmo9Wn&W304;116=3Unwrl8yusk}dO@Kjh;Q5|A_=qgIJ-kr&9%anwJo zUw_*gjC~3U8ur!<1ZN|crcTaAA`xk;B@ju>MiPP9L^u)*$672v6af(|pj|pO6?^y8 zY*1HcvKTG4$UJCs$xGo#;=+ZuXn!%12q&=L7!f#9x-nW~UP^`uG!l%&qN((Iz>sFt zM8-k|Fo&PoZ+c10UG)t$ML-Z3?$p;bwU12ry`+S&+^Ev1hCciz{G@x_0S^y`heElB zxMec&k{jB~-!?2RgiA^i>10S}gplS9)sPP>aS*813@AgjTOg`=gNMxO$;E{QaHP|L z`%KV_On(L_vmJzm&$m&faYjUbQjwCkkPgABOb zZWkIKP~}`?Q{JXqVq zkWuOx^Ms`ybI22rdZe*X6o&}>C~sND2Gkn95eFEz54i0fG_G!!bZnSlbK6eB97V>w zz!VO2Djv7j>mnYYirjj=z7ePa!eM(!A%HAE^^k`642$8=dk3*ng8GB5&@+iS7pBuR zclFfP8u{8@G);4^Sj=qZb61+rpqTkGpFF>=(HE@0tsrYnZb5^-W?*ya)7fh=rpeD+ zo2SZCtyOJN73Xa%F5XgFTwGF7QlW-XQe3iCU81H-^HYtcTBFnH>UP%| zKoa=T%`sF1K*G>ar!zDHMH>1-z7~_kY91c8R2U>{qi!iOCU9I%0hWNr6Hd^w1aRcz zaDol1xgJkMjN#;U3W!HzT)DqS`&dx31LMac82YAxfll-{T?5Y#bk5?MoSlutA~Cde zWX8~L#v+jf+@Q}OwFsI*7%|!)3C+Sqj0tJdG7~0-@QgnZhK&AHn6K8;*d~?;zkUM4 zSekQ9M?DvNu=c~(>9LldjLmyM4o4H9VD=-AarI3#1-Z0;U5JxNH8?cY{xE(udu#Ob z$5g9}tHbEp(Vp^NEGdcc>B8bnouqb?2Q4jaQrJCe)A$^@sL!1Xd8q}a@ML;U>NSQI z0AgnRn21X@^GuTF3RokR%r-u%ByAw@!U#lJqqJja&gFW&UBA9yQ_-fP!lI%A6nsNX z6N&h%y}$ZR5ZZ5_l%jj|>e2`860-)x~Rmt|S>=p?T*=(T~a$OT0!<4p;WQ^s+74XVtJ z9lZT%Li1At@t}?kH3@ItU#u+-Q!h{H!t~g=icvGNv}iktvX%p=7)|4sDLcd*5BZ@6 zvqF;ve4cHt6KnL)s&8)`Qy zYzoKe!U0-Kp{+OCokJk))}_z~3PLOyC!M&aj~MwB0XWoXJul_Ggr$D|a%ArE+&GkS zWmh>o1t(WdSfLf=ByHsSNN7{Ulc%X6AbFFt_d(dwUTQ|qh%JL7n0P~o9R+%qyNR8q zi@=f3xuB0ln;Nz^=uuOeYS8J3N=m!Ces4_HHsH9H&VQL~tQvLjV0z>KW zLNc{Lt4XOeRB0ZOA_lHvbF@;2oWqMVnX!0yF0*r&zC@Ecyg_(y*m&Bs?+OZ~jk4xA z3X!PoCo%Ekfyf0H7qIa8Ov87xzOlZjpy=!Caqgp#CfR$@lJhzF$R$D)yNVh)tq%LtmAk4EM(Ihdb^Qi_x2i?P{2kmNv8SE%4bd1lIroBx~d)wPHPs6-hSFF~FhM8CG zaEm*JgW5^I+iW+xjb7xP$DUpccqYB}aq5x?jgV>F!fPk0G4|C_ae;dr=M+)Vv3E|L zF>s&ud3^IR@>9J=)#rsFn@QSZCmrBx0EM}?+<4nfH{HDID-GCM=)$5883XMD4fEcu zc_r%0BnBl8HEfiywz`l$>9^Pv& z5Z?5=)?X8L{NMpZqV-2oJc6345`s8|cm$4^tg3Iv!X+jG>M+S4=XFMpAw^Lk&0TA- z5Lttz$V>y2aI02tE}2E=Avb%0S>D`Wwb)kIh}l~_6Oc?x?w?B3B_VO%j(Q0}zyZk! zP1H}`KB9^cq$DJjwOqic?m~0~Ci3cxX{fE$*5)`ohTN zOVrQd)D`ao!_@uBy&?65nQoDv%);0VKtMK6OUw&(pogj_YA$uqvH6+M>})6$nT>>I z0^y(~G&wah8{u`F8`u;dnQwf2yk{M$SfhfpS>8MT2z=i$#Ye02GCgv4)1W&_;*{5c$xD z#BHic#4ROtrpx9M6V80sX-W>LjsAq$v{fT*Rqx(at@DJ6x9Zf@#kO4~EhQ!$PQQud zkfQvo_~}?rIvh$R!gGlPCg|Zn;$$ooOhsoRLO#la(E7Y@Z%!XG8;+U1JQiNBF{UUi z-%j%3zZ9r1yvkr`0T~lm+)qX@cV7r&2%k#fSWv{XfZC2SSXfAeQ(@F<)N9-@V{^QH zq}>13kCI;@0xa&Po*!hP(82>Gi*Mf?z{;M<=tc-y5Ze3DV_gsP7#dVSFbpPWJkd^* zuLZ7z;mf3eeDF0lcNr>5UjAIB5NM)!aC9)^;3OK*Q4qJe1BMvn$yClxZZx{rNP&@& z5zl$tAqoi7_T^Q~{L6Rjz@KL}q0CWnsGNZ%#%4=PVah0}3uTE6)K*@xaoCc30Rt~9 z@DLxtLIyce;PQXW1O-T6;m6!4l;VXU|4ECt1|q3UpoolOA{iTsa@VXcDqN5Cl-ml? zVH1k@6AhO9mfn3}?=+?qsB{ZxvXf*kpdU`brvIMcSUA@_IZcWX&MQ=|WQ!Ap!Xp=M zrc=#GAm@+gDPS8dYEFA07roD_ofuWG?yjmDh-g zXOh3qk7ZrmbPLXM;UvWx8ccNII2WF-4jf%*S{Uef|NUR5FI|p|Ljx0Ym#2brn9t6m zf4p@5($vU24T-oANFY<@lw?LqP%}u&#mVKOd=c20yznN6i$(H@H3gm>E-T@e?)*^P)RTfBb&>W ziG#nv1>rBi#Y>$>%nOM6T9WbY3-4YSzi|EnUFR>n_4Wu%_};$oT0AkIz*u}ff*%~* z#u>Os90W+r<6XcYcPD(5b7*I_-DZt{`csH@`v_G8BmSuJ)f>C1Bu_ZIZEV{~Krj;n51MwyLTsuU=hWuc?4b zqpfc;c2fhh_FDa1U1_J)p4yU!h z-qcDmnvQ(*(c@pb^Gn4!t5@gbXXj_<6j9Fp6&^WbSi5`t*YL+&91Tofgv<@BSZnA8}P=ug?DxxZx}{tj_tfyH>06 zSKm_AYHGBY@W}@f4UaI$vEsQ#wwko{B%|Tke|Y@G`g$y8o7(VM1B1zAFtu?vK6TJ0 z-*5)M``z)0nF-(Q4E~ff6N3?(iNHYyzhg5eo<7%Y`o`bXA&$(OZHBfsM2k3e6qf-( zlnRfxmCA@pi!Sou6ASRbB%9w5g=Ew|Qt=4(3$$81_~J>GRxMoQ(`Yr^hYf`)Btr}H zrg~W9qTg;)Bll1k`5R4{cqk4$YDA)=m_($A9n>oP>b3QnDg#+sgI4zoFd4`p{1m8x zAG;YEEy?)HC!ToXu{MLn+2_EA6dZm1c>3C&?{`?c9oC)~U+%W`Ic$z2FYiBrAZy=? zM-KP&gTrC#JN)vIBM!LmIfcVV_QS@jAnxz$>*kTbFu9MvHu?cy=*N0Kt@q<0^kovf zle6!4yzt@2v!iWJ*Qm?267a!HWEAQ2lZ;RNeI|-|sp}8%Gz17AG7wtAk|x(QQxs<*^3d-T9A7o@O1vJ{#fyyvSgEkMQ(W@cTZ zsdzd`e`~`5#|uG6w~foFyYtRFx9SjOtJBdeIZ)(74hMZqgg$%Wd|7;6WT@{u6F>p=;x9lLx zEtwB|_j{IOZkGmsMYbBRF&t=iIgu#gh>v*mN^pjaKF%Q+GW_u2+cH*5w}rkX1B()}n$i4O_>WU~Acbcbt;A)9K}p(3MrUcM zuA&~FD$y2~s;Zo}oC-}ca`SnS2%_$O7U5hR>zPk zTa~XZ&9e@fa!N}}f1pvdI@@wo6;&!tX+^2ZFl5tK#LWpLCGHiU z%tR#DibU{{n{&w`W=Pj0&eWMcn}b>kM?ZQY6fzo;ZhT|~RGR}2-P{d}JbiYDy$@wi zVSVJ{954_pGZG&)P2h%s7p{wi$3fxr9T$XyjR(s~5D_mx8Xg50L|NbY z7rym_QjNN_q%?c2N?od{C@C&2(QZ-aWoLgaJ3D)A_U+kg^Vi-^Kjh+e$_E!7hYd;Y z%^NlrZ`cgkH>>W$4Y7-{1rJ$q|Fo0~Od@MY>T0z{t*KTEQ6cFrLp5#9bHj+%f$gvi89u5a^oH^9AK!}UZM3S6< zcQc_2F*&*'."\n"; // Title print '
Demo '.$profilearray['label'].'Demo '.$profilearray['label'].''.$langs->trans($profilearray['label']).'