Merge branch '15.0' of https://github.com/Dolibarr/dolibarr into 15_fix_graph_ficheinter_status

This commit is contained in:
Florian HENRY 2022-06-23 10:14:43 +02:00
commit c702d8a4ac
5 changed files with 48 additions and 10 deletions

View File

@ -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 '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("DraftFichinter").'</th></tr>';
$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 '<tr class="oddeven">';
print '<td class="nowrap">';
print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowFichinter"), "intervention").' '.$obj->ref."</a></td>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).'</a></td></tr>';
print '<td class="nowrap tdoverflowmax100">';
print $fichinterstatic->getNomUrl(1);
print "</td>";
print '<td class="nowrap tdoverflowmax100">';
print $companystatic->getNomUrl(1, 'customer');
print '</td></tr>';
$i++;
}
}

View File

@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '</td>';
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="linkedcol-ref">'.$objectlink->ref_client.'</td>';
echo '<td class="linkedcol-date">'.dol_print_date($objectlink->date, 'day').'</td>';
echo '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht;

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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) {