diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 61a81495cf6..72ffd2b6bba 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -6,8 +6,8 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2019 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -1077,6 +1077,7 @@ if ($action == 'create') print ''; } + $reg = array(); if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { $object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 18efd14815e..ac2573d6b27 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1257,7 +1257,7 @@ function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = '', $noprin * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Object db - * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object + * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket... to list events linked to an object * @param Contact $objcon Filter on object contact to filter events on a contact * @param int $noprint Return string but does not output it * @param string $actioncode Filter on actioncode @@ -1265,9 +1265,10 @@ function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = '', $noprin * @param array $filters Filter on other fields * @param string $sortfield Sort field * @param string $sortorder Sort order + * @param string $module You can add module name here if elementtype in table llx_actioncomm is objectkey@module * @return string|void Return html part or void if noprint is 1 */ -function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC') +function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC', $module = '') { global $user, $conf; global $form; @@ -1367,7 +1368,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; if ($force_filter_contact === false) { if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql .= " AND a.fk_soc = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql .= " AND a.fk_project = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { /* Nothing */ } + elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql .= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; @@ -1394,7 +1396,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id; } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) { - $sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element)."'"; + // Generic case + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? '@'.$module : '')."'"; if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id; } } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e5a201a4c5a..243ab783c30 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1747,18 +1747,19 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $ret = ''; $regs = array(); - // If we ask an resource form external module (instead of default path) + // If we ask a resource form external module (instead of default path) if (preg_match('/^([^@]+)@([^@]+)$/i', $objecttype, $regs)) { $myobject = $regs[1]; $module = $regs[2]; } - - // Parse $objecttype (ex: project_task) - $module = $myobject = $objecttype; - if (preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) - { - $module = $regs[1]; - $myobject = $regs[2]; + else { + // Parse $objecttype (ex: project_task) + $module = $myobject = $objecttype; + if (preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) + { + $module = $regs[1]; + $myobject = $regs[2]; + } } // Generic case for $classpath @@ -1821,7 +1822,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') // Generic case for $classfile and $classname $classfile = strtolower($myobject); $classname = ucfirst($myobject); - //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname; + //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath; if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index e406bf6e1f2..2f673ea445b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1040,4 +1040,5 @@ ShowOtherLanguages=Show other languages SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language NotUsedForThisCustomer=Not used for this customer AmountMustBePositive=Amount must be positive -ByStatus=By status \ No newline at end of file +ByStatus=By status +InformationMessage=Information \ No newline at end of file diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 70625bf3bf4..9c3bbe0bec0 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -830,7 +830,7 @@ class MyObject extends CommonObject if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("mymodule"); + //$langs->load("mymodule@mymodule"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); @@ -939,7 +939,7 @@ class MyObject extends CommonObject public function getNextNumRef() { global $langs, $conf; - $langs->load("mymodule@myobject"); + $langs->load("mymodule@mymodule"); if (empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_myobject_standard'; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index e3a3699f445..0dbd92aa379 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -147,7 +147,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $this->db = $db; $this->name = "standard"; - $this->description = $langs->trans('PDFStandardDescription'); + $this->description = $langs->trans('DocumentModelStandardPDF'); $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template // Dimension page diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index c76d0cd78e4..244a7e01a9c 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -244,7 +244,7 @@ if ($object->id > 0) $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, 'mymmodule'); } } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 3ced73318a6..20d6588f3d6 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -583,7 +583,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); + $somethingshown = $formactions->showactions($object, $object->element.'@mymodule', (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); print ''; }