Fix popup of companies in contract home page
This commit is contained in:
parent
3e273d4004
commit
fe2a58cf1d
@ -241,7 +241,7 @@ print "</table></div><br>";
|
||||
|
||||
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
|
||||
$sql = "SELECT c.rowid, c.ref,";
|
||||
$sql .= " s.nom as name, s.rowid as socid";
|
||||
$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -266,8 +266,6 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftContracts").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
//$tot_ttc = 0;
|
||||
while ($i < $num) {
|
||||
@ -276,22 +274,29 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire) {
|
||||
$staticcontrat->ref = $obj->ref;
|
||||
$staticcontrat->id = $obj->rowid;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->client = 1;
|
||||
$staticcompany->id = $obj->socid;
|
||||
$staticcompany->name = $obj->name;
|
||||
$staticcompany->name_alias = $obj->name_alias;
|
||||
$staticcompany->photo = 1;
|
||||
$staticcompany->code_client = $obj->code_client;
|
||||
$staticcompany->code_fournisseur = $obj->code_fournisseur;
|
||||
$staticcompany->code_compta = $obj->code_compta;
|
||||
$staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
$staticcompany->client = $obj->client;
|
||||
$staticcompany->fournisseur = $obj->fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
print $staticcontrat->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1, '', 16);
|
||||
print $staticcompany->getNomUrl(1, '', 16);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//$tot_ttc+=$obj->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoContracts").'</td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans("NoContracts").'</span></td></tr>';
|
||||
}
|
||||
print "</table></div><br>";
|
||||
$db->free($resql);
|
||||
@ -312,7 +317,8 @@ $sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.
|
||||
$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')", 1, 0).') as nb_expired,';
|
||||
$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", 1, 0).') as nb_late,';
|
||||
$sql .= " sum(".$db->ifsql("cd.statut=5", 1, 0).') as nb_closed,';
|
||||
$sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom as name, s.rowid as socid";
|
||||
$sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut,";
|
||||
$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
@ -328,7 +334,8 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid";
|
||||
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut,";
|
||||
$sql .= " s.nom, s.name_alias, s.logo, s.rowid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
$sql .= " ORDER BY c.tms DESC";
|
||||
$sql .= $db->plimit($max);
|
||||
|
||||
@ -356,6 +363,14 @@ if ($result) {
|
||||
|
||||
$staticcompany->id = $obj->socid;
|
||||
$staticcompany->name = $obj->name;
|
||||
$staticcompany->name_alias = $obj->name_alias;
|
||||
$staticcompany->photo = 1;
|
||||
$staticcompany->code_client = $obj->code_client;
|
||||
$staticcompany->code_fournisseur = $obj->code_fournisseur;
|
||||
$staticcompany->code_compta = $obj->code_compta;
|
||||
$staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
$staticcompany->client = $obj->client;
|
||||
$staticcompany->fournisseur = $obj->fournisseur;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
@ -389,9 +404,9 @@ if ($result) {
|
||||
print '<br>';
|
||||
|
||||
// Last modified services
|
||||
$sql = "SELECT c.ref, c.fk_soc, ";
|
||||
$sql = "SELECT c.ref, c.fk_soc as socid,";
|
||||
$sql .= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
|
||||
$sql .= " s.nom as name,";
|
||||
$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -427,9 +442,23 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
|
||||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
|
||||
$staticcontrat->id = $obj->fk_contrat;
|
||||
|
||||
$staticcompany->id = $obj->socid;
|
||||
$staticcompany->name = $obj->name;
|
||||
$staticcompany->name_alias = $obj->name_alias;
|
||||
$staticcompany->photo = 1;
|
||||
$staticcompany->code_client = $obj->code_client;
|
||||
$staticcompany->code_fournisseur = $obj->code_fournisseur;
|
||||
$staticcompany->code_compta = $obj->code_compta;
|
||||
$staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
$staticcompany->client = $obj->client;
|
||||
$staticcompany->fournisseur = $obj->fournisseur;
|
||||
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
|
||||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -449,8 +478,6 @@ if ($resql) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="tdoverflowmax125">';
|
||||
$staticcompany->id = $obj->fk_soc;
|
||||
$staticcompany->name = $obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td class="nowrap right"><a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
@ -471,7 +498,7 @@ print '<br>';
|
||||
|
||||
// Not activated services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
|
||||
$sql .= " s.nom as name,";
|
||||
$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -507,19 +534,32 @@ if ($resql) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticcompany->id = $obj->fk_soc;
|
||||
$staticcompany->name = $obj->name;
|
||||
$staticcompany->name_alias = $obj->name_alias;
|
||||
$staticcompany->photo = 1;
|
||||
$staticcompany->code_client = $obj->code_client;
|
||||
$staticcompany->code_fournisseur = $obj->code_fournisseur;
|
||||
$staticcompany->code_compta = $obj->code_compta;
|
||||
$staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
$staticcompany->client = $obj->client;
|
||||
$staticcompany->fournisseur = $obj->fournisseur;
|
||||
|
||||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
|
||||
$staticcontrat->id = $obj->fk_contrat;
|
||||
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
$productstatic->entity = $obj->pentity;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td class="nowraponall">';
|
||||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
|
||||
$staticcontrat->id = $obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
$productstatic->entity = $obj->pentity;
|
||||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
@ -531,8 +571,6 @@ if ($resql) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="tdoverflowmax125">';
|
||||
$staticcompany->id = $obj->fk_soc;
|
||||
$staticcompany->name = $obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
@ -553,7 +591,7 @@ print '<br>';
|
||||
|
||||
// Expired services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
|
||||
$sql .= " s.nom as name,";
|
||||
$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -590,19 +628,32 @@ if ($resql) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticcompany->id = $obj->fk_soc;
|
||||
$staticcompany->name = $obj->name;
|
||||
$staticcompany->name_alias = $obj->name_alias;
|
||||
$staticcompany->photo = 1;
|
||||
$staticcompany->code_client = $obj->code_client;
|
||||
$staticcompany->code_fournisseur = $obj->code_fournisseur;
|
||||
$staticcompany->code_compta = $obj->code_compta;
|
||||
$staticcompany->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
$staticcompany->client = $obj->client;
|
||||
$staticcompany->fournisseur = $obj->fournisseur;
|
||||
|
||||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
|
||||
$staticcontrat->id = $obj->fk_contrat;
|
||||
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
$productstatic->entity = $obj->pentity;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td class="nowraponall">';
|
||||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->fk_contrat);
|
||||
$staticcontrat->id = $obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
$productstatic->entity = $obj->pentity;
|
||||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
@ -614,8 +665,6 @@ if ($resql) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="tdoverflowmax125">';
|
||||
$staticcompany->id = $obj->fk_soc;
|
||||
$staticcompany->name = $obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user