diff --git a/ChangeLog b/ChangeLog index 5ec86761300..6fd632f4307 100644 --- a/ChangeLog +++ b/ChangeLog @@ -100,9 +100,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 @@ -149,6 +151,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: @@ -181,6 +184,7 @@ Dolibarr better: - Fix: Show sender Country on PDF docs when sender Country <> receiver Country - 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 ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5d20743d029..3744a9e4bab 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); 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/commande/card.php b/htdocs/commande/card.php index 1291d6cce26..62577387bbd 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 4f8eb73a8db..000b1f7de90 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/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 62ed89dd65b..57863100999 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -45,7 +46,7 @@ class box_project extends ModeleBoxes $langs->load("boxes"); $langs->load("projects"); - $this->boxlabel="Projet"; + $this->boxlabel="Projects"; } /** @@ -63,13 +64,8 @@ class box_project extends ModeleBoxes $totalMnt = 0; $totalnb = 0; $totalnbTask=0; - include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); - require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); - $projectstatic=new Project($db); - - - $textHead = $langs->trans("Projet"); + $textHead = $langs->trans("Projects"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders @@ -91,14 +87,15 @@ class box_project extends ModeleBoxes $i = 0; while ($i < $num) { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); - $objp = $db->fetch_object($result); - $projectstatic->fetch($objp->rowid); + + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', + 'logo' => 'object_project', + 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$projectstatic->getNomUrl(1) - ); + 'text' => $objp->ref, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left"', 'text' => $objp->title diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 54c7b9d860d..d0e4e086640 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 61d1c08f2aa..e90dbdd203d 100644 --- 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 1ef5045c845..34f6418de34 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -997,7 +997,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])) { @@ -1006,7 +1005,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..4f0439d7b3c 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -356,9 +356,18 @@ class FormOther 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 =''; + $out.=''; // Get list of users allowed to be viewed $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; @@ -383,34 +392,35 @@ class FormOther { while ($obj_usr = $this->db->fetch_object($resql_usr)) { - $moreforfilter.=''; + $out.=($moreinfo?')':''); + $out.=''; } $this->db->free($resql_usr); } @@ -418,9 +428,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/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 '
'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 246af863d12..219d0074813 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -784,9 +784,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $sql = "SELECT MAX(".$sqlstring.") as val"; $sql.= " FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; - $sql.= " AND ".$field." NOT LIKE '%PROV%'"; + $sql.= " AND ".$field." NOT LIKE '(PROV%)'"; if ($bentityon) // only if entity enable $sql.= " AND entity IN (".getEntity($table, 1).")"; + if ($where) $sql.=$where; if ($sqlwhere) $sql.=' AND '.$sqlwhere; 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 781de5f2913..74d6b95df73 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 6ee45778d18..423d1565f8c 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 28ef737de13..4ab0cfdb96b 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/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 753f91fbdda..09556bd9125 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 38a0f79a6ea..9542fc062e7 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/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 8d5d7c26a53..74204a176e4 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -11,7 +11,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 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/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 69b0664eb9d..e3dff71b721 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 390f250f5d9..ba179aef616 100644 --- 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/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 }