diff --git a/ChangeLog b/ChangeLog index 46f482aeab9..8775d808037 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,9 +4,12 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.4 compared to 3.3 ***** For users: -- New: Some performance enhancements +- New: Some performance enhancements. +- New: Can attach files onto trip and expenses modules. For developers: +- System of menu managers has been rewritten to reduce code to do same things. +- An external module can force its theme. For translators: diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 4d7bf0df4ae..355964273f2 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -106,7 +106,7 @@ class modMyModule extends DolibarrModules // Constants // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), - // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); $this->const = array(); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 4cf1e0b7d89..ea481c64661 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -189,7 +189,7 @@ if (! empty($conf->banque->enabled)) else { print '
| ".$langs->trans("DefaultContact").' | '; $form->select_contacts($soc->id,$setcontact,'contactidp',1,$srccontactslist); print ' | |
| '.$langs->trans('Discounts').' | ';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
@@ -1686,7 +1684,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
print ' '; - print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$hookmanager); + print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); $somethingshown=$formfile->numoffiles; /* @@ -3384,7 +3382,7 @@ else if ($id > 0 || ! empty($ref)) $outputlangs->setDefaultLang($newlang); } - $result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + $result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cf7b89be7aa..b96fd57916d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -541,7 +541,7 @@ class Facture extends CommonInvoice * @param HookManager $hookmanager Hook manager instance * @return int New id of clone */ - function createFromClone($socid=0,$hookmanager=false) + function createFromClone($socid=0) { global $conf,$user,$langs; @@ -637,7 +637,7 @@ class Facture extends CommonInvoice */ function createFromOrder($object) { - global $conf,$user,$langs; + global $conf,$user,$langs,$hookmanager; $error=0; @@ -701,8 +701,6 @@ class Facture extends CommonInvoice if ($ret > 0) { // Actions hooked (by external module) - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); $hookmanager->initHooks(array('invoicedao')); $parameters=array('objFrom'=>$object); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 12d653e5b26..796bf769698 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -97,8 +97,6 @@ $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MA $object=new Facture($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); $hookmanager->initHooks(array('invoicecard')); $now=dol_now(); diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index a3eaa76d463..50ce36d4e9c 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -112,7 +112,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs); } header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index 0bf129c567b..c8d710e2831 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -94,7 +94,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs); } header('Location: fiche.php?id='.$paiement->id); diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index 45dc91263ad..c8139c5575f 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -41,8 +41,6 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); $hookmanager->initHooks(array('taxvatcard')); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index c1eb6426c7b..14c8630e1e5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -210,7 +210,7 @@ class Contact extends CommonObject */ function update($id, $user=0, $notrigger=0, $action='update') { - global $conf, $langs; + global $conf, $langs, $hookmanager; $error=0; @@ -266,8 +266,6 @@ class Contact extends CommonObject unset($this->state); // Actions on extra fields (by external module or standard code) - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); $hookmanager->initHooks(array('contactdao')); $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 0233c367b07..9097584bfb5 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -65,8 +65,6 @@ if (! empty($canvas)) $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); $hookmanager->initHooks(array('contactcard')); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 50c30e4be2b..9578bf54c98 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -59,8 +59,6 @@ $result=restrictedArea($user,'contrat',$id); $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); $hookmanager->initHooks(array('contractcard')); $object = new Contrat($db); @@ -211,7 +209,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer) setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")),'errors'); $error++; } - + if (! $error) { $ret=$object->fetch($id); @@ -1284,7 +1282,7 @@ else if ($user->rights->contrat->creer && ($object->statut >= 0)) { $dateSelector=1; - + print ' '; print ' | |
| '.$langs->trans('Ref').' | '; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 75414d8f109..685dfa93b9a 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -454,7 +454,7 @@ class Conf throw new Exception('Log handler does not extend LogHandlerInterface'); } - $this->loghandlers[]=$loghandlerinstance; + if (empty($conf->loghandlers[$handler])) $this->loghandlers[$handler]=$loghandlerinstance; } } } diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 0c31a7569fa..cca22038746 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -179,7 +179,7 @@ class HookManager if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result; } - //print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction; + //print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a804948bf1d..f31cb0f741e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -688,8 +688,21 @@ class Form if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo) { //$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); - - $out.= ajax_combobox($htmlname, $event); + $out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + /* + if ($selected && empty($selected_input_value)) + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); + $product->fetch($selected); + $selected_input_value=$product->ref; + } + // mode=1 means customers products + $ajaxoptions=array(); + $urloption='htmlname='.$htmlname.'&outjson=1&filter='.urlencode($filter).'&showtype='.$showtype; + $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + $out.=''; + */ } $out.= '||