diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index aad02f2bd07..fd820b2de6a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -39,6 +39,9 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; +if (!empty($conf->ficheinter->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +} // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager = new HookManager($db); @@ -100,6 +103,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $supplierorderstatic = new CommandeFournisseur($db); } +if (!empty($conf->ficheinter->enabled)) { + $fichinterstatic = new Fichinter($db); +} + llxHeader("", $langs->trans("CommercialArea")); print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial'); @@ -508,7 +515,12 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU * Draft interventionals */ if (!empty($conf->ficheinter->enabled)) { - $sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid"; + $sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut"; + $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; + $sql .= ", s.code_client, s.code_compta, s.client"; + $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; + $sql .= ", s.logo, s.email, s.entity"; + $sql .= ", s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { @@ -524,22 +536,46 @@ if (!empty($conf->ficheinter->enabled)) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } + $resql = $db->query($sql); if ($resql) { + $num = $db->num_rows($resql); + $nbofloop = min($num, $maxofloop); + print '
'; print ''; print ''; print ''; - $langs->load("fichinter"); - $num = $db->num_rows($resql); + if ($num) { $i = 0; - while ($i < $num) { + while ($i < $nbofloop) { $obj = $db->fetch_object($resql); + + $fichinterstatic->id=$obj->rowid; + $fichinterstatic->ref=$obj->ref; + $fichinterstatic->statut=$obj->fk_statut; + + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $companystatic->name_alias = $obj->name_alias; + $companystatic->code_client = $obj->code_client; + $companystatic->code_compta = $obj->code_compta; + $companystatic->client = $obj->client; + $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; + $companystatic->fournisseur = $obj->fournisseur; + $companystatic->logo = $obj->logo; + $companystatic->email = $obj->email; + $companystatic->entity = $obj->entity; + $companystatic->canvas = $obj->canvas; print ''; - print '"; - print ''; + print '"; + print ''; $i++; } } diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 2a6140aaeed..9c6ed818957 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; echo ''; echo ''; - echo ''; + echo ''; echo '
'.$langs->trans("DraftFichinter").'
'; - print "rowid."\">".img_object($langs->trans("ShowFichinter"), "intervention").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).'
'; + print $fichinterstatic->getNomUrl(1); + print "'; + print $companystatic->getNomUrl(1, 'customer'); + print '
'.$objectlink->getNomUrl(1).''.$objectlink->ref_client.''.dol_print_date($objectlink->date, 'day').''.dol_print_date($objectlink->date, 'day').''; if ($user->rights->commande->lire) { $total = $total + $objectlink->total_ht; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 5e803ae3cdf..b98ce37d8f1 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1324,6 +1324,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' if (in_array($objecttmp->element, array('societe', 'member'))) { $result = $objecttmp->delete($objecttmp->id, $user, 1); + } elseif (in_array($objecttmp->element, array('action'))) { + $result = $objecttmp->delete(); } else { $result = $objecttmp->delete($user); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1cdcfcdc54c..ffc88c157ff 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -682,7 +682,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null // - posted value not empty, or // - if posted value is empty and a default value exists that is not empty (it means we did a filter to an empty value when default was not). - if ($out != '') { // $out = '0' or 'abc', it is a search criteria to keep + if ($out != '' && isset($user)) {// $out = '0' or 'abc', it is a search criteria to keep $user->lastsearch_values_tmp[$relativepathstring][$paramname] = $out; } } diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 8b80492685d..0659c39d394 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -125,7 +125,7 @@ class CommActionRapport $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products")); $dir = $conf->agenda->dir_temp."/"; - $file = $dir."actions-".$this->month."-".$this->year.".pdf"; + $file = $dir."actions-".sprintf("%02d", $this->month)."-".sprintf("%04d", $this->year).".pdf"; if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) {