From bd69d37c3a23ac5eb25dcd7e23f092a66d474fb9 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 17 Aug 2015 05:29:12 +0200 Subject: [PATCH 01/20] New: Add number of expense reports to pay --- htdocs/admin/delais.php | 6 ++ htdocs/core/class/conf.class.php | 2 + .../class/expensereport.class.php | 83 +++++++++++++++++++ htdocs/index.php | 33 ++++++-- htdocs/install/mysql/data/llx_const.sql | 1 + .../install/mysql/migration/3.8.0-3.9.0.sql | 22 +++++ htdocs/langs/en_US/trips.lang | 2 + 7 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 htdocs/install/mysql/migration/3.8.0-3.9.0.sql diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index e48dba1c355..1a96bac49ad 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -97,6 +97,12 @@ $modules=array( 'img' => 'user' ) ), + 'expensereport' => array( + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS', + 'img' => 'trip' + ) + ), ); if ($action == 'update') diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 13d2881563f..29fed41a6ad 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -474,6 +474,7 @@ class Conf $this->adherent->cotisation = new stdClass(); $this->bank->rappro = new stdClass(); $this->bank->cheque = new stdClass(); + $this->expensereport->payment = new stdClass(); $this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60; $this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60; $this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60; @@ -486,6 +487,7 @@ class Conf $this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60; $this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60; $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; + $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; // For modules that want to disable top or left menu if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9a802ac7f34..e0934e422d3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1465,6 +1465,89 @@ class ExpenseReport extends CommonObject return $ret; } + /** + * Charge indicateurs this->nb pour le tableau de bord + * + * @return int <0 if KO, >0 if OK + */ + function load_state_board() + { + global $conf; + + $this->nb=array(); + + $sql = "SELECT count(ex.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; + $sql.= " WHERE ex.fk_statut > 0"; + $sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["expensereports"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + + } + + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @param User $user Objet user + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK + */ + function load_board($user) + { + global $conf, $langs; + + if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + + $now=dol_now(); + + $sql = "SELECT ex.rowid, ex.date_valid"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; + $sql.= " WHERE ex.fk_statut = 5"; + $sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + $langs->load("members"); + + $response = new WorkboardResponse(); + $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24; + $response->label=$langs->trans("ExpenseReportsToPay"); + $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5'; + $response->img=img_object($langs->trans("ExpenseReports"),"user"); + + while ($obj=$this->db->fetch_object($resql)) + { + $response->nbtodo++; + + if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) { + $response->nbtodolate++; + } + } + + return $response; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } } diff --git a/htdocs/index.php b/htdocs/index.php index 8c37688c0f8..7462b05b3e7 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -158,7 +158,8 @@ if (empty($user->societe_id)) ! empty($conf->facture->enabled) && $user->rights->facture->lire, ! empty($conf->contrat->enabled) && $user->rights->contrat->activer, ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire, - ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire); + ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire, + ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire); // Class file containing the method load_state_board for each line $includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/societe/class/client.class.php", @@ -171,7 +172,8 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php"); + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php"); // Name class containing the method load_state_board for each line $classes=array('Client', 'Client', @@ -184,7 +186,8 @@ if (empty($user->societe_id)) 'Facture', 'Contrat', 'CommandeFournisseur', - 'FactureFournisseur'); + 'FactureFournisseur', + 'ExpenseReport'); // Cle array returned by the method load_state_board for each line $keys=array('customers', 'prospects', @@ -197,7 +200,8 @@ if (empty($user->societe_id)) 'invoices', 'Contracts', 'supplier_orders', - 'supplier_invoices'); + 'supplier_invoices', + 'expensereports'); // Dashboard Icon lines $icons=array('company', 'company', @@ -210,7 +214,8 @@ if (empty($user->societe_id)) 'bill', 'order', 'order', - 'bill'); + 'bill', + 'trip'); // Translation keyword $titres=array("ThirdPartyCustomersStats", "ThirdPartyProspectsStats", @@ -223,7 +228,8 @@ if (empty($user->societe_id)) "BillsCustomers", "Contracts", "SuppliersOrders", - "SuppliersInvoices"); + "SuppliersInvoices", + "ExpenseReports"); // Dashboard Link lines $links=array(DOL_URL_ROOT.'/comm/list.php', DOL_URL_ROOT.'/comm/prospect/list.php', @@ -236,7 +242,8 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy', DOL_URL_ROOT.'/contrat/list.php', DOL_URL_ROOT.'/fourn/commande/list.php', - DOL_URL_ROOT.'/fourn/facture/list.php'); + DOL_URL_ROOT.'/fourn/facture/list.php', + DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'); // Translation lang files $langfile=array("companies", "prospects", @@ -247,7 +254,8 @@ if (empty($user->societe_id)) "propal", "orders", "bills", - "contracts"); + "contracts", + "trips"); // Loop and displays each line of table @@ -402,6 +410,15 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use $dashboardlines[] = $board->load_board($user); } +// Number of expense reports to pay +if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) +{ + include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $board=new ExpenseReport($db); + + $dashboardlines[] = $board->load_board($user); +} + // Calculate total nb of late $totallate=0; $var=true; diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 3b627f3d99b..13604638f01 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -75,6 +75,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_NOT insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_RUNNING_SERVICES','0','chaine','Tolérance de retard avant alerte (en jours) sur services expirés',0); insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_MEMBERS','31','chaine','Tolérance de retard avant alerte (en jours) sur cotisations adhérent en retard',0); insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE','62','chaine','Tolérance de retard avant alerte (en jours) sur rapprochements bancaires à faire',0); +insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); -- diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql new file mode 100644 index 00000000000..9f5131df1ec --- /dev/null +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -0,0 +1,22 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 3.9.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To restrict request to Mysql version x.y use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + +insert into llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 3b54b6d9714..c6f4f316a04 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -102,3 +102,5 @@ ConfirmSaveTrip=Are you sure you want to validate this expense report ? NoTripsToExportCSV=No expense report to export for this period. ExpenseReportPayment=Expense report payment + +ExpenseReportsToPay=Expense reports to pay From d6b84233edc4a80ff4543671876e1220327d8255 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Tue, 18 Aug 2015 16:40:03 +0200 Subject: [PATCH 02/20] NEW: Translate extrafield's labels --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 58597862f8c..70b22d94c5e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3794,7 +3794,7 @@ abstract class CommonObject */ function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') { - global $_POST, $conf; + global $_POST, $conf, $langs; $out = ''; @@ -3852,7 +3852,7 @@ abstract class CommonObject if($extrafields->attribute_required[$key]) $label = ''.$label.''; - $out .= ''.$label.''; + $out .= ''.$langs->trans($label).''; $out .=''; switch($mode) { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 7100453cab5..ca8785acdfb 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -49,7 +49,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>' . $label . ''; + print '>' . $langs->trans($label) . ''; //TODO Improve element and rights detection //var_dump($user->rights); From 1b117d5581b0ab20c16b7c5e3db47073dd6f023d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 21 Aug 2015 14:10:55 +0200 Subject: [PATCH 03/20] add in get_origin function generic origintype actually we have only internal module origintype propose to add feature to add stockmovement from other external module --- htdocs/product/stock/class/mouvementstock.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 52c69b16ec6..1e72e151044 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -660,9 +660,16 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $origin = new FactureFournisseur($this->db); break; - + default: - return ''; + if ($origintype) + { + require_once DOL_DOCUMENT_ROOT.'/'.$origintype.'/class/'.$origintype.'.class.php'; + $classname = ucfirst($origintype); + $origin = new $classname($this->db); + } + else + return ''; break; } From af7302fa90bc43fb537aa7356695bec82f252ecb Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 23 Aug 2015 00:30:11 +0200 Subject: [PATCH 04/20] change done --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 1e72e151044..21bfad54f0e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -664,7 +664,7 @@ class MouvementStock extends CommonObject default: if ($origintype) { - require_once DOL_DOCUMENT_ROOT.'/'.$origintype.'/class/'.$origintype.'.class.php'; + dol_include_once ('/'.$origintype.'/class/'.$origintype.'.class.php'); $classname = ucfirst($origintype); $origin = new $classname($this->db); } From 154f6cff9f4adb1bc3bcce71681f75243b8a3ba4 Mon Sep 17 00:00:00 2001 From: Guido Schratzer Date: Wed, 26 Aug 2015 18:35:15 +0200 Subject: [PATCH 05/20] Fix: htdocs/projet/element.php Logoposition Fixed Logo from center to right set table width to 100 % --- htdocs/projet/element.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 6302994181a..4f692c3f515 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -345,9 +345,9 @@ $langs->load("proposals"); $langs->load("margins"); //print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); -print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; +print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; -print '
'; +print '
'; print ''; print ''; print ''; From cea47f3e25e9c127da196b9c4dfb5f8e72892e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 26 Aug 2015 19:30:40 +0200 Subject: [PATCH 06/20] Added tags/categories management to suppliers Suppliers part of #2571 --- htdocs/fourn/card.php | 9 ++- htdocs/societe/soc.php | 144 ++++++++++++++++++++++++++++++----------- 2 files changed, 114 insertions(+), 39 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 78a78195d37..5a1f38806bb 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -4,8 +4,9 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2014 Jean Heimburger + * Copyright (C) 2014 Jean Heimburger * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -262,6 +263,12 @@ if ($object->id > 0) print ""; print ''; + // Categories + print ''; + print '"; + // Other attributes $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 864f507494a..b80f0f2c086 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1,14 +1,15 @@ - * Copyright (C) 2003 Brian Fraval - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2011-2013 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Marcos García +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2003 Brian Fraval + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2011-2013 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -411,7 +412,7 @@ if (empty($reshook)) } } - // Categories association + // Customer categories association $custcats = GETPOST( 'custcats', 'array' ); if (!empty( $custcats )) { $cat = new Categorie( $db ); @@ -421,6 +422,16 @@ if (empty($reshook)) } } + // Supplier categories association + $suppcats = GETPOST('suppcats', 'array'); + if (!empty($suppcats)) { + $cat = new Categorie($db); + foreach ($suppcats as $id_category) { + $cat->fetch($id_category); + $cat->add_type($object, 'supplier'); + } + } + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -525,7 +536,7 @@ if (empty($reshook)) $error = $object->error; $errors = $object->errors; } - // Categories association + // Customer categories association // First we delete all categories association $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_societe'; $sql .= ' WHERE fk_soc = ' . $object->id; @@ -541,6 +552,22 @@ if (empty($reshook)) } } + // Supplier categories association + // First we delete all categories association + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_fournisseur'; + $sql .= ' WHERE fk_soc = ' . $object->id; + $db->query($sql); + + // Then we add the associated categories + $categories = GETPOST('suppcats', 'array'); + if (!empty($categories)) { + $cat = new Categorie($db); + foreach ($categories as $id_category) { + $cat->fetch($id_category); + $cat->add_type($object, 'supplier'); + } + } + // Logo/Photo save $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -1245,13 +1272,26 @@ else } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - print '"; - } + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print '"; + } + + // Supplier + if ($object->fournisseur) { + print '"; + } + } // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); @@ -1761,19 +1801,36 @@ else } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - print ''; - print ''; + print '"; } - print $form->multiselectarray( 'custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); - print ""; - } + + // Supplier + if ($object->fournisseur) { + print ''; + print '"; + } + } // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); @@ -2207,13 +2264,24 @@ else } // Tags / categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - print ''; - print '"; - } + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print ''; + print '"; + } + + // Supplier + if ($object->fournisseur) { + print ''; + print '"; + } + } // Incoterms if (!empty($conf->incoterm->enabled)) From 33ea968b5bfae265f4cc9b50121e5b5b99fec6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 26 Aug 2015 19:42:12 +0200 Subject: [PATCH 07/20] Fix #3218 Bank date selectors presentation --- htdocs/compta/bank/account.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index c64d8b48e3d..6bb5a1f95a3 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -528,11 +528,11 @@ if ($id > 0 || ! empty($ref)) print ''; $period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1); - $period_filter .= '
'. $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); + $period_filter .= ' '; + $period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); print '
'; - print ''; - print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; // Nature From e4bddb4a00506e9943b4a3c77f33fd679d62f05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sun, 30 Aug 2015 13:47:02 +0200 Subject: [PATCH 20/20] NEW Added __PROJECT_NAME__ tag for customer invoice emails --- htdocs/compta/facture.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7f5b33ee73a..143c93cfe22 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3851,6 +3851,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__REFCLIENT__'] = $object->ref_client; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); + $formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:''); $formmail->substit['__PERSONALIZED__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = '';
'.$langs->trans("Element").''.$langs->trans("Number").'
' . $langs->trans("Categories") . ''; + print $form->showCategories($object->id, 'supplier', 1); + print "
'.fieldLabel('Categories','custcats').''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); - print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); - print "
' . fieldLabel('CustomersCategoriesShort', 'custcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, + null, "90%"); + print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); + print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, + null, "90%"); + print "
'.fieldLabel('Categories', 'custcats').''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_CUSTOMER, null, null, null, null, 1); - $c = new Categorie( $db ); - $cats = $c->containing( $object->id, Categorie::TYPE_CUSTOMER ); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client) { + print '
' . fieldLabel('CustomersCategoriesShort', 'custcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print "
' . $langs->trans( "Categories" ) . ''; - print $form->showCategories( $object->id, 'customer', 1 ); - print "
' . $langs->trans("CustomersCategoriesShort") . ''; + print $form->showCategories($object->id, 'customer', 1); + print "
' . $langs->trans("SuppliersCategoriesShort") . ''; + print $form->showCategories($object->id, 'supplier', 1); + print "
 '.$period_filter.''.$period_filter.''; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $filtertype=''; From ba1ad9f317c3fd57a58c8d4b191e8e5eb0d50cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 26 Aug 2015 19:51:06 +0200 Subject: [PATCH 08/20] Fix #3219 More conventional presentation --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 6302994181a..b8c66cf8491 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -345,7 +345,7 @@ $langs->load("proposals"); $langs->load("margins"); //print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); -print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; +print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; print ''; print ''; From 2527ae263be5e3da3f3e0e19572f9b29d66eb106 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 14:28:12 +0200 Subject: [PATCH 09/20] fix : Fatal error: Uncaught exception 'Exception' with message 'Incorrect log level' --- htdocs/core/class/commonobject.class.php | 6 ++--- htdocs/core/lib/pdf.lib.php | 33 +++++++++++------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4bbe7b3aa98..fc740b5215a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ abstract class CommonObject * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') { global $conf; @@ -1865,11 +1865,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - if (empty($sourceid) && empty($targetid)) + /*if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - } + }*/ // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 794ba7ac2af..0350bce7a4b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1585,55 +1585,52 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { - $objects[$i]->fetchObjectLinked(); - $order = $objects[$i]->linkedObjects['commande'][0]; + $elementobject->fetchObjectLinked(); + $order = $elementobject->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } } } From db7defb7c30e982807211df2a4983e9c3440d14e Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 14:43:48 +0200 Subject: [PATCH 10/20] Revert "fix : Fatal error: Uncaught exception 'Exception' with message 'Incorrect log level'" This reverts commit 2527ae263be5e3da3f3e0e19572f9b29d66eb106. --- htdocs/core/class/commonobject.class.php | 6 ++--- htdocs/core/lib/pdf.lib.php | 33 +++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fc740b5215a..4bbe7b3aa98 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ abstract class CommonObject * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') + function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') { global $conf; @@ -1865,11 +1865,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - /*if (empty($sourceid) && empty($targetid)) + if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - }*/ + } // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 0350bce7a4b..794ba7ac2af 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1585,52 +1585,55 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { - $elementobject->fetchObjectLinked(); - $order = $elementobject->linkedObjects['commande'][0]; + $objects[$i]->fetchObjectLinked(); + $order = $objects[$i]->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); } } } From e9f631d2e3a78f3c3277a4415c3f2c4082537914 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 14:49:12 +0200 Subject: [PATCH 11/20] fix : Fatal error: Uncaught exception 'Exception' with message 'Incorrect log level' --- 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 4bbe7b3aa98..ce71b953208 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ abstract class CommonObject * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') { global $conf; From 134bd42c4ec1ddae5768b43983560e28757adfc9 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Aug 2015 15:13:29 +0200 Subject: [PATCH 12/20] Increase length of column pcg_version to 32 --- .../install/mysql/migration/3.8.0-3.9.0.sql | 22 +++++++++++++++++++ .../mysql/tables/llx_accounting_system.sql | 2 +- .../mysql/tables/llx_accountingaccount.sql | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 htdocs/install/mysql/migration/3.8.0-3.9.0.sql diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql new file mode 100644 index 00000000000..84570f9075e --- /dev/null +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -0,0 +1,22 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 3.9.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To restrict request to Mysql version x.y use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + +ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); +ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_accounting_system.sql b/htdocs/install/mysql/tables/llx_accounting_system.sql index 50a9c66b054..b0be95c7666 100644 --- a/htdocs/install/mysql/tables/llx_accounting_system.sql +++ b/htdocs/install/mysql/tables/llx_accounting_system.sql @@ -21,7 +21,7 @@ create table llx_accounting_system ( rowid integer AUTO_INCREMENT PRIMARY KEY, - pcg_version varchar(12) NOT NULL, + pcg_version varchar(32) NOT NULL, fk_pays integer NOT NULL, label varchar(128) NOT NULL, active smallint DEFAULT 0 diff --git a/htdocs/install/mysql/tables/llx_accountingaccount.sql b/htdocs/install/mysql/tables/llx_accountingaccount.sql index f4e4d694471..3847ce91811 100644 --- a/htdocs/install/mysql/tables/llx_accountingaccount.sql +++ b/htdocs/install/mysql/tables/llx_accountingaccount.sql @@ -24,7 +24,7 @@ create table llx_accountingaccount entity integer DEFAULT 1 NOT NULL, datec datetime, tms timestamp, - fk_pcg_version varchar(12) NOT NULL, + fk_pcg_version varchar(32) NOT NULL, pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, account_number varchar(32) NOT NULL, From aff134ab65f862a9ca6c1cd3dbe3c9b1e2a5ef80 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Aug 2015 16:10:02 +0200 Subject: [PATCH 13/20] Fix #3289 Salaries module shows amounts with currency symbol unlike the rest of Dolibarr --- htdocs/compta/salaries/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 678b3bfaa2e..008a0ef3e2c 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -168,7 +168,7 @@ if ($result) // Type print ''; // Amount - print ""; + print ""; print ""; print "\n"; @@ -177,7 +177,7 @@ if ($result) $i++; } print ''; - print '"; + print '"; print ""; print "
'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency)."".price($obj->amount)." 
'.$langs->trans("Total").''.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."'.price($total)." 
"; From 6952084be30cef84b22f668bcec0541f240e882f Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 17:23:23 +0200 Subject: [PATCH 14/20] it's a mess --- htdocs/core/class/commonobject.class.php | 4 +-- htdocs/core/lib/pdf.lib.php | 33 +++++++++++------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ce71b953208..fc740b5215a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1865,11 +1865,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - if (empty($sourceid) && empty($targetid)) + /*if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - } + }*/ // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 794ba7ac2af..0350bce7a4b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1585,55 +1585,52 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { - $objects[$i]->fetchObjectLinked(); - $order = $objects[$i]->linkedObjects['commande'][0]; + $elementobject->fetchObjectLinked(); + $order = $elementobject->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } } } From 17b69e16d2fe6bbe487c03c13ea94f054b34cbb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2015 13:45:23 +0200 Subject: [PATCH 15/20] Fix remove a bad log reporting error when not --- htdocs/contact/class/contact.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ba12d039e10..3e1e3fd1720 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -499,9 +499,10 @@ class Contact extends CommonObject */ function fetch($id, $user=0, $ref_ext='') { - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); global $langs; + dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); + $langs->load("companies"); $sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; @@ -524,7 +525,6 @@ class Contact extends CommonObject if ($id) $sql.= " WHERE c.rowid = ". $id; elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -565,7 +565,7 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; - $this->skype = $obj->skype; + $this->skype = $obj->skype; $this->priv = $obj->priv; $this->mail = $obj->email; From c8f12dc5f2dcfff71f799a114e893ac061e4bd3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2015 15:06:42 +0200 Subject: [PATCH 16/20] Fix PUT method for already formated strings --- htdocs/core/lib/geturl.lib.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8f6847bcb9a..3b62556f482 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -24,12 +24,12 @@ /** * Function get content from an URL (use proxy if proxy defined) * - * @param string $url URL to call. - * @param string $postorget 'POST', 'GET', 'HEAD' - * @param string $param Parameters of URL (x=value1&y=value2) - * @param string $followlocation 1=Follow location, 0=Do not follow - * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) - * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) + * @param string $url URL to call. + * @param string $postorget 'POST', 'GET', 'HEAD', 'PUTALREADYFORMATED' + * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED + * @param string $followlocation 1=Follow location, 0=Do not follow + * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) + * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) */ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array()) { @@ -74,10 +74,19 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea else if ($postorget == 'PUT') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' - if ( ! is_array($param) ) - parse_str($param, $array_param); + if (! is_array($param)) parse_str($param, $array_param); + else + { + dol_syslog("parameter param must be a string", LOG_WARNING); + $array_param=$param; + } curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields } + else if ($postorget == 'PUTALREADYFORMATED') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string + } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' From 8fd7f0f383588960092d1317f5d2df64a262f24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sat, 29 Aug 2015 21:41:15 +0200 Subject: [PATCH 17/20] Removed odd test --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 8ed3c312e50..e5527a8d2fd 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -744,7 +744,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass // First line of company infos $line1=""; $line2=""; $line3=""; $line4=""; - if ($showdetails && 1) + if ($showdetails) { // Company name if ($fromcompany->name) From 3482031b8a334ca49efd5fdc53897d1195fdb081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sat, 29 Aug 2015 21:44:05 +0200 Subject: [PATCH 18/20] Removed second odd test --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e5527a8d2fd..dfb805782f0 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -788,7 +788,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $line2.=($line2?" - ":"").$fromcompany->email; } } - if (($showdetails && 2) || ($fromcompany->country_code == 'DE')) + if ($showdetails || ($fromcompany->country_code == 'DE')) { // Managers if ($fromcompany->managers) From b908f10c5bd84891e5ba0e6c4c97529aa3e24508 Mon Sep 17 00:00:00 2001 From: fappels Date: Sun, 30 Aug 2015 11:50:47 +0200 Subject: [PATCH 19/20] Fix missing product label in package tab --- htdocs/product/composition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 9e8cd7acef3..96e4c955cd6 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -204,7 +204,7 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans("Label").''.$object->libelle.'
'.$langs->trans("Label").''.$object->label.'