diff --git a/ChangeLog b/ChangeLog index 7a8978a0c12..61c83e5bcbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -115,9 +115,11 @@ For users: - Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action - Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message +- Fix: [ bug #1533 ] Links triggers do not show trigger error message - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. - Fix: [ bug #1535 ] Supplier invoice Extrafields are not shown - Fix: datepicker first day of week can be monday by setting into display setup +- Fix: [ bug #575 ] GED doesn't works if there is "/" in a mask For users, new experimental module (need to set feature level of instance to experimental to see them): - New: Module Accounting Expert to manage accountancy @@ -164,6 +166,7 @@ For developers: - Qual: Renamed all files & links "fiche.php" into "card.php". - Qual: Replace all constants COMPTA_* by ACCOUNTING_*. - Qual: Replace all constants ACCOUNTINGEX_* by ACCOUNTING_* to simplify migration of the module +- Fix: [ bug #1724 ] Can't add a submenu to projects WARNING: Following changes may create regression for some external modules, but was necessary to make Dolibarr better: @@ -197,6 +200,9 @@ Dolibarr better: - Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS - Fix: [ bug #1749 ] Undefined $mailchimp - Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks +- Fix: [ bug #1649 ] Cancel button of several thirdparty actions, does the same thing as modify +- Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks +- Fix: [ bug #1731 ] Can't use quick navigation on project tasks secondary tabs ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: @@ -339,6 +345,9 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f ***** ChangeLog for 3.5.7 compared to 3.5.6 ***** Fix: Paypal link were broken dur to SSL v3 closed. +Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers +Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H +Fix: [ bug #1757 ] Sorting breaks product/service statistics ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index a0f535c2b7b..aaa1949d7dd 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -147,7 +147,7 @@ if ($action == 'setModuleOptions') } // Activate a model -if ($action == 'set') +else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } @@ -222,7 +222,7 @@ else if ($action == 'set_COMMANDE_FREE_TEXT') } } -//Activate Set Shippable Icon In List +// Activate Set Shippable Icon In List else if ($action=="setshippableiconinlist") { $setshippableiconinlist = GETPOST('value','int'); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity); @@ -234,6 +234,23 @@ else if ($action=="setshippableiconinlist") { } } +// Activate ask for payment bank +else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') +{ + $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER",$value,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} + /* * View @@ -576,6 +593,36 @@ if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { print ''; print ''; +// Ask for payment bank during order +if ($conf->banque->enabled) +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); + } + else + { + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print ''; +} +else +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '.$langs->trans('NotAvailable').''; +} + print ''; print '
'; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 8a4df52748c..5b64c834401 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -80,15 +80,20 @@ $parameters = array('socid' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +//Some actions show a "cancel" input submit button with name="cancel" +$cancelbutton = GETPOST('cancel'); if ($action == 'setcustomeraccountancycode') { - $result=$object->fetch($id); - $object->code_compta=$_POST["customeraccountancycode"]; - $result=$object->update($object->id,$user,1,1,0); - if ($result < 0) + if (! $cancelbutton) { - setEventMessage($object->errors, 'errors'); + $result=$object->fetch($id); + $object->code_compta=$_POST["customeraccountancycode"]; + $result=$object->update($object->id,$user,1,1,0); + if ($result < 0) + { + setEventMessage($object->errors, 'errors'); + } } $action=""; } @@ -140,10 +145,13 @@ if ($action == 'cstc') // Update communication level if ($action == 'setOutstandingBill') { - $object->fetch($id); - $object->outstanding_limit=GETPOST('OutstandingBill'); - $result=$object->set_OutstandingBill($user); - if ($result < 0) setEventMessage($object->error,'errors'); + if (!$cancelbutton) + { + $object->fetch($id); + $object->outstanding_limit=GETPOST('OutstandingBill'); + $result=$object->set_OutstandingBill($user); + if ($result < 0) setEventMessage($object->error,'errors'); + } } @@ -289,24 +297,15 @@ if ($id > 0) print ''; // Local Taxes - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + if ($mysoc->useLocalTax(1)) { - print ''.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print ''; - print ''.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''.$langs->trans("LocalTax1IsUsedES").''; + print ''.$langs->trans("LocalTax1IsUsedES").''; print yn($object->localtax1_assuj); print ''; } - elseif($mysoc->localtax2_assuj=="1") + if ($mysoc->useLocalTax(2)) { - print ''.$langs->trans("LocalTax2IsUsedES").''; + print ''.$langs->trans("LocalTax2IsUsedES").''; print yn($object->localtax2_assuj); print ''; } diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index b35e4fab7cc..06b26d88f48 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -56,7 +56,7 @@ $search_compta=GETPOST("search_compta"); $search_status = GETPOST("search_status",'int'); // Load sale and categ filters -$search_sale = GETPOST("search_sale"); +$search_sale = GETPOST("search_sale",'int'); $search_categ = GETPOST("search_categ",'int'); $catid = GETPOST("catid",'int'); // If the internal user must only see his customers, force searching by him @@ -103,17 +103,17 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url); $sql = "SELECT s.rowid, s.nom as name, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,"; $sql.= " s.datec, s.canvas"; -if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) +if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; // We need this table joined to the select in order to filter by categ -if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale +if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " AND s.client IN (1, 3)"; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; -if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc"; +if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; if ($socid) $sql.= " AND s.rowid = ".$socid; -if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; @@ -130,7 +130,7 @@ if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_comp if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); // Insert sale filter -if ($search_sale) +if ($search_sale > 0) { $sql .= " AND sc.fk_user = ".$search_sale; } @@ -154,7 +154,7 @@ if ($result) $param = "&search_company=".$search_company."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; - if ($search_sale != '') $param.='&search_sale='.$search_sale; + if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_status != '') $param.='&search_status='.$search_status; print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 6110186fcb4..267f205a671 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -189,8 +189,8 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'propal'); $keys=array_keys($tmp); $model=$keys[0]; } $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } @@ -499,9 +499,6 @@ else if ($action == 'add' && $user->rights->propal->creer) $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'propal'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1314,7 +1311,7 @@ if ($action == 'create') print ''; // Bank Account - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) { + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { print '' . $langs->trans('BankAccount') . ''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index be22043e4b5..589afedd00c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -47,6 +47,11 @@ class Propal extends CommonObject public $fk_element='fk_propal'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $socid; // Id client diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0f62552dcae..c28128e81c5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -152,7 +152,7 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p'; if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale -if ($search_sale || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) { $sql.=", ".MAIN_DB_PREFIX."element_contact as c"; diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 3501d94aafd..dcebc06a43d 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -141,8 +141,8 @@ if ($resql) else dol_print_error($db); // Load sale and categ filters -$search_sale = GETPOST('search_sale'); -$search_categ = GETPOST('search_categ'); +$search_sale = GETPOST('search_sale','int'); +$search_categ = GETPOST('search_categ','int'); // If the internal user must only see his prospect, force searching by him if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id; @@ -200,11 +200,11 @@ $sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; // We need this table joined to the select in order to filter by categ -if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale +if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " AND s.client IN (2, 3)"; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; -if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc"; +if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; if ($socid) $sql.= " AND s.rowid = " .$socid; if (isset($stcomm) && $stcomm != '') $sql.= " AND s.fk_stcomm=".$stcomm; if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; @@ -229,7 +229,7 @@ if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; } // Insert sale filter -if ($search_sale) +if ($search_sale > 0) { $sql .= " AND sc.fk_user = ".$db->escape($search_sale); } @@ -281,7 +281,7 @@ if ($resql) if ($search_level_from != '') $param.='&search_level_from='.$search_level_from; if ($search_level_to != '') $param.='&search_level_to='.$search_level_to; if ($search_categ != '') $param.='&search_categ='.$search_categ; - if ($search_sale != '') $param.='&search_sale='.$search_sale; + if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_status != '') $param.='&search_status='.$search_status; // $param and $urladd should have the same value $urladd = $param; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 309b0c35e1a..a6abf123653 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -922,8 +922,8 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'order'); $keys=array_keys($tmp); $model=$keys[0]; } $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } @@ -971,8 +971,8 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) { $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'order'); $keys=array_keys($tmp); $model=$keys[0]; } $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 49ba2536bfa..06f381a41a9 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -44,6 +44,11 @@ class Commande extends CommonOrder public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $socid; // Id client diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ef5d1d90bea..9f104180def 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -417,8 +417,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'invoice'); $keys=array_keys($tmp); $model=$keys[0]; } $ret = $object->fetch($id); // Reload to get new records + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -500,8 +500,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_ $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'invoice'); $keys=array_keys($tmp); $model=$keys[0]; } $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } @@ -1328,8 +1328,8 @@ else if ($action == 'addline' && $user->rights->facture->creer) $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'invoice'); $keys=array_keys($tmp); $model=$keys[0]; } $ret = $object->fetch($id); // Reload to get new records + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 632381c8541..f81fb37849f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -50,6 +50,11 @@ class Facture extends CommonInvoice public $fk_element = 'fk_facture'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'facnumber'; + var $id; //! Id client var $socid; @@ -833,7 +838,6 @@ class Facture extends CommonInvoice return $result; } - /** * Get object and lines from database * diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index fb8bc162c83..1d684c65552 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,6 +34,11 @@ class ChargeSociales extends CommonObject public $table='chargesociales'; public $table_element='chargesociales'; + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; var $date_ech; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ae384195162..5265f7025c5 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -44,6 +44,11 @@ class Contrat extends CommonObject public $fk_element='fk_contrat'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; var $ref_ext; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6ab8c6c75f2..18927b9df51 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2014 Philippe Grand - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-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 @@ -54,6 +54,12 @@ abstract class CommonObject // No constructor as it is an abstract class + /** + * Column name of the ref field. + * @var string + */ + protected $table_ref_field = ''; + /** * Check an object id/ref exists @@ -631,6 +637,32 @@ abstract class CommonObject } + /** + * Looks for an object with ref matching the wildcard provided + * It does only work when $this->table_ref_field is set + * + * @param string $ref Wildcard + * @return int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO + */ + public function fetchOneLike($ref) + { + if (!$this->table_ref_field) { + return 0; + } + + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE '.$this->table_ref_field.' LIKE "'.$this->db->escape($ref).'" LIMIT 1'; + + $query = $this->db->query($sql); + + if (!$this->db->num_rows($query)) { + return 0; + } + + $result = $this->db->fetch_object($query); + + return $this->fetch($result->rowid); + } + /** * Load data for barcode into properties ->barcode_type* * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e0f14424367..0152c34db7d 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2010-2014 Philippe Grand * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2013 Raphaël Doursenaud * Copyright (C) 2014 Alexandre Spangaro * @@ -400,14 +400,26 @@ class Form else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag $s=""; if (empty($notabs)) $s.=''; - if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; + if ($direction < 0) { + $s.='<'.$tag.$paramfortooltipimg; + if ($tag == 'td') { + $s .= 'valign="top" '; + } + $s.= 'width="14">'.$img.''; + } // Use another method to help avoid having a space in value in order to use this value with jquery // TODO add this in css //if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').''; $paramfortooltiptd.= (($direction < 0)?' style="padding-left: 3px !important;"':''); $paramfortooltiptd.= (($direction > 0)?' style="padding-right: 3px !important;"':''); if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.''; - if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; + if ($direction > 0) { + $s.='<'.$tag.$paramfortooltipimg; + if ($tag == 'td') { + $s .= 'valign="top" '; + } + $s.= 'width="14">'.$img.''; + } if (empty($notabs)) $s.='
'; return $s; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 3a0f19929f6..bea2fa7347e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -998,7 +998,6 @@ class FormFile if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if (! $id && ! $ref) continue; - $found=0; if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) { @@ -1007,7 +1006,19 @@ class FormFile else { //print 'Fetch '.$id." - ".$ref.'
'; - $result=$object_instance->fetch($id,$ref); + + if ($id) { + $result = $object_instance->fetch($id); + } else { + //fetchOneLike looks for objects with wildcards in its reference. + //It is useful for those masks who get underscores instead of their actual symbols + //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned + //that's why we look only look fetchOneLike when fetch returns 0 + if (!$result = $object_instance->fetch('', $ref)) { + $result = $object_instance->fetchOneLike($ref); + } + } + if ($result > 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]=dol_clone($object_instance); } // Save object into a cache if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; unset($filearray[$key]); } } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index d6cf08594bb..29d1140d215 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -349,16 +349,26 @@ class FormOther * @param string $htmlname Name of combo list (example: 'search_sale') * @param User $user Object user * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status + * @param int $showempty 1=show also an empty value * @return string Html combo list code */ - function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0) + function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1) { global $conf,$langs; $langs->load('users'); + $out = ''; + $nodatarole = ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out.= ajax_combobox($htmlname); + $nodatarole=' data-role="none"'; + } // Select each sales and print them in a select input - $moreforfilter =''; + if ($showempty) $out.=''; // Get list of users allowed to be viewed $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; @@ -383,34 +393,35 @@ class FormOther { while ($obj_usr = $this->db->fetch_object($resql_usr)) { - $moreforfilter.=''; + $out.=($moreinfo?')':''); + $out.=''; } $this->db->free($resql_usr); } @@ -418,9 +429,9 @@ class FormOther { dol_print_error($this->db); } - $moreforfilter.=''; + $out.=''; - return $moreforfilter; + return $out; } /** diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index dce575a1d47..0cdc6a8c4a8 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -187,7 +187,7 @@ class Link extends CommonObject { // Call trigger $result=$this->call_trigger('LINK_MODIFY',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -197,6 +197,7 @@ class Link extends CommonObject $this->db->commit(); return 1; } else { + setEventMessages('', $this->errors, 'errors'); $this->db->rollback(); return -1; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 9b64bc01bbf..19d0cabc07f 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -388,7 +388,7 @@ class DoliDBPgsql extends DoliDB if ((! empty($host) && $host == "socket") && ! defined('NOLOCALSOCKETPGCONNECT')) { $con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty - $this->db = pg_connect($con_string); + $this->db = @pg_connect($con_string); } // if local connection failed or not requested, use TCP/IP @@ -398,7 +398,7 @@ class DoliDBPgsql extends DoliDB if (! $port) $port = 5432; $con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'"; - $this->db = pg_connect($con_string); + $this->db = @pg_connect($con_string); } // now we test if at least one connect method was a success @@ -837,7 +837,7 @@ class DoliDBPgsql extends DoliDB // Test charset match LC_TYPE (pgsql error otherwise) //print $charset.' '.setlocale(LC_CTYPE,'0'); exit; - $sql='CREATE DATABASE '.$database.' OWNER '.$owner.' ENCODING \''.$charset.'\''; + $sql='CREATE DATABASE "'.$database.'" OWNER "'.$owner.'" ENCODING \''.$charset.'\''; dol_syslog($sql,LOG_DEBUG); $ret=$this->query($sql); return $ret; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 3d51490f6b2..23a17534ccf 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -149,7 +149,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh if (! empty($conf->browser->phone)) print ''; else print ''; - if (! empty($conf->browser->phone)) print '
'; + if (! empty($conf->browser->phone)) print '
'; else print ''; print ''; // Local Taxes - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + if ($mysoc->useLocalTax(1)) { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; } - elseif($mysoc->localtax2_assuj=="1") + if ($mysoc->useLocalTax(2)) { - print ''; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7593dcf9903..4fe4675f5d8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -45,6 +45,11 @@ class CommandeFournisseur extends CommonOrder public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; // TODO deprecated diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 95da7550db7..d9a4469481f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -43,6 +43,11 @@ class FactureFournisseur extends CommonInvoice public $fk_element='fk_facture_fourn'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $rowid; var $ref; var $product_ref; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f85a7a042f2..b90bd275e4c 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -357,10 +357,8 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'order_supplier'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -462,10 +460,8 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'order_supplier'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -526,10 +522,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'order_supplier'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 248fa0af59a..05e8590628f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -711,10 +711,8 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'invoice_supplier'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -793,10 +791,8 @@ elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer) $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'invoice_supplier'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 2281793929f..0b71a2fe6fe 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -220,8 +220,8 @@ create table llx_accounting_fiscalyear fk_user_modif integer NULL )ENGINE=innodb; -ALTER TABLE llx_contrat ADD COLUMN ref_ext varchar(30) after ref; -ALTER TABLE llx_contrat ADD COLUMN ref_supplier varchar(30) after ref_ext; +ALTER TABLE llx_contrat ADD COLUMN ref_supplier varchar(30) after ref; +ALTER TABLE llx_contrat ADD COLUMN ref_ext varchar(30) after ref_supplier; ALTER TABLE llx_propal ADD COLUMN fk_shipping_method integer AFTER date_livraison; ALTER TABLE llx_commande ADD COLUMN fk_shipping_method integer AFTER date_livraison; diff --git a/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql b/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql index 333eb41ad08..0a89810dce5 100644 --- a/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_usergroup_extrafields.sql @@ -21,6 +21,6 @@ CREATE TABLE IF NOT EXISTS llx_usergroup_extrafields ( tms timestamp, fk_object integer NOT NULL, import_key varchar(14) -- import key -) ENGINE=InnoDB ; +)ENGINE=innodb; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8c737eecd52..0b328e705a7 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1157,6 +1157,7 @@ ValidOrderAfterPropalClosed=To validate the order after proposal closer, makes i FreeLegalTextOnOrders=Free text on orders WatermarkOnDraftOrders=Watermark on draft orders (none if empty) ShippableOrderIconInList=Add an icon in Orders list which indicate if order is shippable +BANK_ASK_PAYMENT_BANK_DURING_ORDER=Ask for bank account destination of order ##### Clicktodial ##### ClickToDialSetup=Click To Dial module setup ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags
__PHONETO__ that will be replaced with the phone number of person to call
__PHONEFROM__ that will be replaced with phone number of calling person (yours)
__LOGIN__ that will be replaced with your clicktodial login (defined on your user card)
__PASS__ that will be replaced with your clicktodial password (defined on your user card). diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 9847ce53524..a5dfb52d40c 100755 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -28,10 +28,10 @@ ProductsAndServicesStatistics=Products and Services statistics ProductsStatistics=Products statistics ProductsOnSell=Available products ProductsNotOnSell=Obsolete products -ProductsOnSellAndOnBuy=Products not for sale nor purchase +ProductsOnSellAndOnBuy=Products for sale and for purchase ServicesOnSell=Available services ServicesNotOnSell=Obsolete services -ServicesOnSellAndOnBuy=Services not for sale nor purchase +ServicesOnSellAndOnBuy=Services for sale and for purchase InternalRef=Internal reference LastRecorded=Last products/services on sell recorded LastRecordedProductsAndServices=Last %s recorded products/services diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 8d5d7c26a53..84624b219f9 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -3,6 +3,7 @@ RefProject=Ref. project ProjectId=Project Id Project=Project Projects=Projects +ProjectStatus=Project status SharedProject=Everybody PrivateProject=Contacts of project MyProjectsDesc=This view is limited to projects you are a contact for (whatever is the type). @@ -11,7 +12,6 @@ ProjectsDesc=This view presents all projects (your user permissions grant you pe MyTasksDesc=This view is limited to projects or tasks you are a contact for (whatever is the type). TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). -Myprojects=My projects ProjectsArea=Projects area NewProject=New project AddProject=Create project @@ -131,4 +131,4 @@ ProjectReferers=Refering objects SearchAProject=Search a project ProjectMustBeValidatedFirst=Project must be validated first ProjectDraft=Draft projects -FirstAddRessourceToAllocateTime=Associate a ressource to allocate time \ No newline at end of file +FirstAddRessourceToAllocateTime=Associate a ressource to allocate time diff --git a/htdocs/langs/es_ES/projects.lang b/htdocs/langs/es_ES/projects.lang index 5ac8e82d6f9..3a6ed7f8784 100644 --- a/htdocs/langs/es_ES/projects.lang +++ b/htdocs/langs/es_ES/projects.lang @@ -3,6 +3,7 @@ RefProject=Ref. proyecto ProjectId=Id proyecto Project=Proyecto Projects=Proyectos +ProjectStatus=Estado del proyecto SharedProject=Proyecto compartido PrivateProject=Contactos del proyecto MyProjectsDesc=Esta vista muestra aquellos proyectos en los que usted es un contacto afectado (cualquier tipo). diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 6b29fa82fec..e20b6efae12 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -204,3 +204,11 @@ ACCOUNTING_ACCOUNT_SUPPLIER=Code comptable par défaut des tiers fournisseurs CloneTax=Cloner une charge sociale ConfirmCloneTax=Confirmer le clonage de la charge sociale CloneTaxForNextMonth=Cloner pour le mois suivant +COMPTA_PRODUCT_BUY_ACCOUNT=Code comptable par défaut pour l'achat de produits +COMPTA_PRODUCT_SOLD_ACCOUNT=Code comptable par défaut pour la vente de produits +COMPTA_SERVICE_BUY_ACCOUNT=Code comptable par défaut pour l'achat de services +COMPTA_SERVICE_SOLD_ACCOUNT=Code comptable par défaut pour la vente de services +COMPTA_VAT_ACCOUNT=Code comptable par défaut pour l'encaissement de TVA +COMPTA_VAT_BUY_ACCOUNT=Code comptable par défaut pour le versement de la TVA +COMPTA_ACCOUNT_CUSTOMER=Code comptable par défaut des tiers clients +COMPTA_ACCOUNT_SUPPLIER=Code comptable par défaut des tiers fournisseurs diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 2b6a74a519e..1a89a377fef 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -135,10 +135,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'delivery'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 2304268070c..8a0aefba711 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -57,9 +57,9 @@ $pagenext = $page + 1; $startdate=$enddate=''; if (!empty($_POST['startdatemonth'])) - $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); + $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); if (!empty($_POST['enddatemonth'])) - $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); + $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); /* * View diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 7385342c905..eec35e38430 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -93,7 +93,7 @@ llxHeader('',$langs->trans("PaypalSetup")); $linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre(' - '.$langs->trans("ModuleSetup"),$linkback,'paypal_logo@paypal'); +print_fiche_titre($langs->trans("ModuleSetup").' PayPal',$linkback); print '
'; $head=paypaladmin_prepare_head(); diff --git a/htdocs/paypal/img/object_paypal.png b/htdocs/paypal/img/object_paypal.png index 4ff3c80565d..74ac4392ded 100644 Binary files a/htdocs/paypal/img/object_paypal.png and b/htdocs/paypal/img/object_paypal.png differ diff --git a/htdocs/paypal/img/paypal.png b/htdocs/paypal/img/paypal.png deleted file mode 100644 index 2caabff50b7..00000000000 Binary files a/htdocs/paypal/img/paypal.png and /dev/null differ diff --git a/htdocs/paypal/img/paypal_logo.png b/htdocs/paypal/img/paypal_logo.png deleted file mode 100644 index 2a4fd7c9ad5..00000000000 Binary files a/htdocs/paypal/img/paypal_logo.png and /dev/null differ diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index cc52bf38d87..d739f72afc4 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -46,6 +46,11 @@ class Product extends CommonObject protected $isnolinkedbythird = 1; // No field fk_soc protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $regeximgext='\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff'; //! Identifiant unique diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 8607cfeeb8e..92ad4cfbe1f 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin + * 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 @@ -71,7 +72,9 @@ llxHeader('','',$helpurl); $sql = "SELECT count(*) as c"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; $sql.= ' WHERE entity IN ('.getEntity('product', 1).')'; -if (isset($type)) $sql.= " AND fk_product_type = ".$type; +if ($type !== '') { + $sql.= " AND fk_product_type = ".$type; +} $result=$db->query($sql); if ($result) @@ -82,11 +85,14 @@ if ($result) $param = ''; $title = $langs->trans("ListProductServiceByPopularity"); -if (isset($type)) -{ +if ($type !== '') { $param = '&type='.$type; - $title = $langs->trans("ListProductByPopularity"); - if ($type == 1) $title = $langs->trans("ListServiceByPopularity"); + + if ($type == 1) { + $title = $langs->trans("ListServiceByPopularity"); + } else { + $title = $langs->trans("ListProductByPopularity"); + } } print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$param,"","","",$num); @@ -106,7 +112,9 @@ $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; $sql.= " AND p.rowid = pd.fk_product"; -if (isset($type)) $sql.= " AND fk_product_type = ".$type; +if ($type !== '') { + $sql.= " AND fk_product_type = ".$type; +} $sql.= " GROUP BY (p.rowid)"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit, $offset); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 41ae40a259d..c9d4ed9f546 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -38,6 +38,11 @@ class Project extends CommonObject public $fk_element = 'fk_projet'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $ref; var $description; @@ -568,16 +573,9 @@ class Project extends CommonObject { // Call trigger $result=$this->call_trigger('PROJECT_DELETE',$user); - if ($result < 0) - { + + if ($result < 0) { $error++; - if (! empty($interface->errors)) - { - foreach ($interface->errors as $errmsg ) { - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); - $this->errors[] =$errmsg; - } - } } // End call triggers } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a54e7c45aac..bc7478a0dbb 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -460,8 +460,8 @@ $langs->load("suppliers"); $langs->load("bills"); $langs->load("orders"); $langs->load("proposals"); -$langs->load("margin"); -print_titre($langs->trans("Profit")); +$langs->load("margins"); +print_fiche_titre($langs->trans("Profit"),'',''); print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20b7d4369ac..f4e1fe159fe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2653,10 +2653,11 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m } /** - * Show a title (deprecated. use print_fiche_titre instead) + * Show a title. * * @param string $title Title to show * @return string Title to show + * @deprecated Use print_fiche_titre instead */ function print_titre($title) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 219d0074813..7517fac7d20 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -573,7 +573,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti /** * Return last or next value for a mask (according to area we should not reset) * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @param string $mask Mask to use * @param string $table Table containing field with counter * @param string $field Field containing already used values of counter @@ -581,8 +581,8 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti * @param Societe $objsoc The company that own the object we need a counter for * @param string $date Date to use for the {y},{m},{d} tags. * @param string $mode 'next' for next value or 'last' for last value - * @param bool $bentityon activate the entity filterdefault is true (for modules not compatible with multicompany) - * @return string New value (numeric) or error message + * @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany) + * @return string New value (numeric) or error message */ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true) { diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 06a187fd7de..7acce783e39 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -232,7 +232,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3610__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects&mode=mine', 'MyProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3610__+MAX_llx_menu__, 'project', 'myprojects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects&mode=mine', 'MyProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3611__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create&mode=mine', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3612__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a2c28280984..9b7b49c9d3d 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1132,12 +1132,12 @@ 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, 'projects'); + $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", $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); + $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects'); $newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/list.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index a4d97e7defb..36b6ce75fe1 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -72,11 +72,16 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $link->id = $linkid; $link->fetch(); $res = $link->delete($user); + $langs->load('link'); - if ($res) { + if ($res > 0) { setEventMessage($langs->trans("LinkRemoved", $link->label)); } else { - setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); + if (count($link->errors)) { + setEventMessages('', $link->errors, 'errors'); + } else { + setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); + } } } header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':'')); diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 7d0fc5c64bf..7626774b24c 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -409,7 +409,7 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } - if (! empty($conf->ficheinter->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } + if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); } $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers")); } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 886340b4df0..7ccd24f871b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -279,10 +279,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped $outputlangs->setDefaultLang($newlang); } $model=$object->modelpdf; - if (empty($model)) { - $tmp=getListOfModels($db, 'shipping'); $keys=array_keys($tmp); $model=$keys[0]; - } $ret = $object->fetch($id); // Reload to get new records + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d144d5eee54..fbd5261a55f 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -37,6 +37,11 @@ class Fichinter extends CommonObject public $fk_element='fk_fichinter'; public $table_element_line='fichinterdet'; + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; + var $id; var $socid; // Id client diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 3e234af68cd..8511a3e1a48 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -62,13 +62,17 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if ($action == 'setsupplieraccountancycode') { - $result=$object->fetch($id); - $object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; - $result=$object->update($object->id,$user,1,0,1); - if ($result < 0) - { - $mesg=join(',',$object->errors); - } + $cancelbutton = GETPOST('cancel'); + if (! $cancelbutton) + { + $result=$object->fetch($id); + $object->code_compta_fournisseur=$_POST["supplieraccountancycode"]; + $result=$object->update($object->id,$user,1,0,1); + if ($result < 0) + { + $mesg=join(',',$object->errors); + } + } $action=""; } // conditions de reglement @@ -174,24 +178,15 @@ if ($object->fetch($id)) print '
'.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans("LocalTax1IsUsedES").''; + print '
'.$langs->trans("LocalTax1IsUsed").''; print yn($object->localtax1_assuj); print '
'.$langs->trans("LocalTax2IsUsedES").''; + print '
'.$langs->trans("LocalTax2IsUsed").''; print yn($object->localtax2_assuj); print '
'; print ''; print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 15604ba0e89..99d127fb9a9 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -57,7 +57,7 @@ $projectstatic = new Project($db); // Add new contact if ($action == 'addcontact' && $user->rights->projet->creer) { - $result = $object->fetch($id); + $result = $object->fetch($id, $ref); if ($result > 0 && $id > 0) { @@ -87,7 +87,7 @@ if ($action == 'addcontact' && $user->rights->projet->creer) // bascule du statut d'un contact if ($action == 'swapstatut' && $user->rights->projet->creer) { - if ($object->fetch($id)) + if ($object->fetch($id, $ref)) { $result=$object->swapContactStatus(GETPOST('ligne')); } @@ -100,7 +100,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer) // Efface un contact if ($action == 'deleteline' && $user->rights->projet->creer) { - $object->fetch($id); + $object->fetch($id, $ref); $result = $object->delete_contact($_GET["lineid"]); if ($result >= 0) @@ -152,7 +152,7 @@ $userstatic = new User($db); if ($id > 0 || ! empty($ref)) { - if ($object->fetch($id) > 0) + if ($object->fetch($id, $ref) > 0) { $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index c6ded20ecb4..a9b059fce81 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -103,7 +103,7 @@ print '
'.$langs->trans("Element").'
'; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index d489581e078..9951902ec5b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -73,7 +73,7 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) if (! $error) { - $object->fetch($id); + $object->fetch($id, $ref); $object->fetch_projet(); if (empty($object->projet->statut)) @@ -119,7 +119,7 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree if (! $error) { - $object->fetch($id); + $object->fetch($id, $ref); $object->timespent_id = $_POST["lineid"]; $object->timespent_note = $_POST["timespent_note_line"]; @@ -194,7 +194,7 @@ if ($id > 0 || ! empty($ref)) /* * Fiche projet en mode visu */ - if ($object->fetch($id) >= 0) + if ($object->fetch($id, $ref) >= 0) { $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); diff --git a/scripts/odt2pdf/odt2pdf.sh b/scripts/odt2pdf/odt2pdf.sh index 0599e4291c5..9d9bf18a8c7 100755 --- a/scripts/odt2pdf/odt2pdf.sh +++ b/scripts/odt2pdf/odt2pdf.sh @@ -22,7 +22,7 @@ if [ -f "$1.odt" ] nbprocess=$(pgrep -c soffice) if [ $nbprocess -ne 1 ] then - soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless& + soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless & retcode=$? if [ $retcode -ne 0 ] then
'.$langs->trans("Project").''.$langs->trans("Status").''.$langs->trans("ProjectStatus").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("DateStart").'