Clean code

This commit is contained in:
Laurent Destailleur 2017-11-11 00:28:00 +01:00
parent debc0480dd
commit b8cbb84e7c
13 changed files with 80 additions and 82 deletions

View File

@ -188,6 +188,8 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic=new Commande($db);
$langs->load("orders");
$cachedir = DOL_DATA_ROOT.'/commande/temp';
$filename = '/boxactivity-order'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);

View File

@ -82,7 +82,7 @@ class box_external_rss extends ModeleBoxes
$keyforparamurl="EXTERNAL_RSS_URLRSS_".$site;
$keyforparamtitle="EXTERNAL_RSS_TITLE_".$site;
// Get RSS feed
$url=$conf->global->$keyforparamurl;
@ -106,7 +106,7 @@ class box_external_rss extends ModeleBoxes
'text' => $title,
'sublink' => $link,
'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")),
'subpicto'=>'object_bookmark',
'subpicto'=>'help',
);
}

View File

@ -117,6 +117,7 @@ class box_factures_fourn extends ModeleBoxes
$datelimite=$db->jdate($objp->datelimite);
$date=$db->jdate($objp->df);
$datem=$db->jdate($objp->tms);
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->ref;
$facturestatic->total_ht = $objp->total_ht;
@ -124,6 +125,8 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->ref_supplier = $objp->ref_supplier;
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->fournisseur = 1;

View File

@ -108,27 +108,25 @@ class box_ficheinter extends ModeleBoxes
$ficheinterstatic->statut=$objp->fk_statut;
$ficheinterstatic->id=$objp->rowid;
$ficheinterstatic->ref=$objp->ref;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid);
$this->info_box_contents[$i][] = array('td' => '',
'text' => $ficheinterstatic->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$i][1] = array('td' => '',
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref
'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
$this->info_box_contents[$i][] = array('td' => 'align="left" width="16"',
'logo' => 'company',
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => '',
$this->info_box_contents[$i][] = array('td' => '',
'text' => dol_trunc($objp->name,40),
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'class="right"',
$this->info_box_contents[$i][] = array('td' => 'class="right"',
'text' => dol_print_date($datec,'day'));
$this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"',
$this->info_box_contents[$i][] = array('td' => 'align="right" class="nowrap"',
'text' => $ficheinterstatic->getLibStatut(6),
'asis'=>1
);
@ -136,20 +134,20 @@ class box_ficheinter extends ModeleBoxes
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions"));
if ($num==0) $this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions"));
$db->free($resql);
}
else
{
$this->info_box_contents[0][0] = array( 'td' => '',
$this->info_box_contents[0][] = array( 'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql));
}
}
else
{
$this->info_box_contents[0][0] = array(
$this->info_box_contents[0][] = array(
'td' => 'align="left" class="nohover opacitymedium"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
@ -109,6 +109,7 @@ class box_members extends ModeleBoxes
$memberstatic->firstname=$objp->firstname;
$memberstatic->id = $objp->rowid;
$memberstatic->ref = $objp->rowid;
$memberstatic->company = $objp->company;
if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
@ -126,7 +127,7 @@ class box_members extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $memberstatic->getFullName($langs),
'text' => $memberstatic->company,
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
);

View File

@ -110,22 +110,18 @@ class box_project extends ModeleBoxes
while ($i < min($num, $max)) {
$objp = $db->fetch_object($result);
$tooltip = $langs->trans('Project') . ': ' . $objp->ref;
$this->info_box_contents[$i][0] = array(
'td' => 'align="left" width="16"',
'logo' => 'object_project'.($objp->public?'pub':''),
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
);
$projectstatic->id = $objp->rowid;
$projectstatic->ref = $objp->ref;
$projectstatic->title = $objp->title;
$projectstatic->public = $objp->public;
$this->info_box_contents[$i][1] = array(
$this->info_box_contents[$i][] = array(
'td' => '',
'text' => $objp->ref,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
'text' => $projectstatic->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$i][2] = array(
$this->info_box_contents[$i][] = array(
'td' => '',
'text' => $objp->title,
);
@ -137,28 +133,28 @@ class box_project extends ModeleBoxes
$resultTask = $db->query($sql);
if ($resultTask) {
$objTask = $db->fetch_object($resultTask);
$this->info_box_contents[$i][3] = array(
$this->info_box_contents[$i][] = array(
'td' => 'class="right"',
'text' => $objTask->nb."&nbsp;".$langs->trans("Tasks"),
);
if ($objTask->nb > 0)
$this->info_box_contents[$i][4] = array(
$this->info_box_contents[$i][] = array(
'td' => 'class="right"',
'text' => round($objTask->totprogress/$objTask->nb, 0)."%",
);
else
$this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
$totalnbTask += $objTask->nb;
} else {
$this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => round(0));
$this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0));
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A&nbsp;");
}
$i++;
}
if ($max < $num)
{
$this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...');
$this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...');
$i++;
}
}
@ -166,25 +162,25 @@ class box_project extends ModeleBoxes
// Add the sum à the bottom of the boxes
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$i][] = array(
'tr' => 'class="liste_total"',
'td' => 'align="left" ',
'text' => "&nbsp;",
);
$this->info_box_contents[$i][1] = array(
$this->info_box_contents[$i][] = array(
'td' => '',
'text' => $langs->trans("Total")."&nbsp;".$textHead,
'text' => "&nbsp;",
);
$this->info_box_contents[$i][2] = array(
$this->info_box_contents[$i][] = array(
'td' => 'align="right" ',
'text' => round($num, 0)."&nbsp;".$langs->trans("Projects"),
);
$this->info_box_contents[$i][3] = array(
$this->info_box_contents[$i][] = array(
'td' => 'align="right" ',
'text' => (($max < $num) ? '' : (round($totalnbTask, 0)."&nbsp;".$langs->trans("Tasks"))),
);
$this->info_box_contents[$i][4] = array(
$this->info_box_contents[$i][] = array(
'td' => '',
'text' => "&nbsp;",
);

View File

@ -69,6 +69,8 @@ class box_services_expired extends ModeleBoxes
$this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$now=dol_now();
$this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices",$max));
@ -77,7 +79,7 @@ class box_services_expired extends ModeleBoxes
{
// Select contracts with at least one expired service
$sql = "SELECT ";
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.ref_customer, c.ref_supplier,";
$sql.= " s.nom as name, s.rowid as socid,";
$sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
@ -87,7 +89,7 @@ class box_services_expired extends ModeleBoxes
$sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid";
$sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
$sql.= " ORDER BY date_line ASC";
$sql.= $db->plimit($max, 0);
@ -99,6 +101,7 @@ class box_services_expired extends ModeleBoxes
$i = 0;
$thirdpartytmp = new Societe($this->db);
$contract = new Contrat($this->db);
while ($i < $num)
{
@ -106,30 +109,33 @@ class box_services_expired extends ModeleBoxes
$objp = $db->fetch_object($resql);
$dateline=$db->jdate($objp->date_line);
if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late"));
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => '',
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$this->info_box_contents[$i][2] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"',
$contract->id = $objp->rowid;
$contract->ref = $objp->ref;
$contract->statut = $objp->fk_statut;
$contract->ref_customer = $objp->ref_customer;
$contract->ref_supplier = $objp->ref_supplier;
$dateline=$db->jdate($objp->date_line);
if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late"));
$this->info_box_contents[$i][] = array('td' => '',
'text' => $contract->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"',
'text' => $thirdpartytmp->getNomUrl(1, 'customer'),
'asis' => 1
);
$this->info_box_contents[$i][4] = array('td' => 'align="center"',
$this->info_box_contents[$i][] = array('td' => 'align="center"',
'text' => dol_print_date($dateline,'day'),
'text2'=> $late);
$this->info_box_contents[$i][5] = array('td' => 'class="right"',
$this->info_box_contents[$i][] = array('td' => 'class="right"',
'text' => $objp->nb_services);
@ -139,14 +145,14 @@ class box_services_expired extends ModeleBoxes
if ($num==0)
{
$langs->load("contracts");
$this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices"));
$this->info_box_contents[$i][] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices"));
}
$db->free($resql);
}
else
{
$this->info_box_contents[0][0] = array( 'td' => '',
$this->info_box_contents[0][] = array( 'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql));
}

View File

@ -109,28 +109,20 @@ class box_supplier_orders extends ModeleBoxes
$objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande);
$datem=$db->jdate($objp->tms);
$thirdpartytmp->id = $objp->socid;
$supplierorderstatic->id = $objp->id;
$supplierorderstatic->ref = $objp->ref;
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->fournisseur = 1;
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
$thirdpartytmp->logo = $objp->logo;
$urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid;
$urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid;
$tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref;
$this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $tooltip,
'url' => $urlo,
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $objp->ref,
'tooltip' => $tooltip,
'url' => $urlo,
'text' => $supplierorderstatic->getNomUrl(1),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
@ -158,14 +150,14 @@ class box_supplier_orders extends ModeleBoxes
}
if ($num == 0)
$this->info_box_contents[$line][0] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="center"',
'text' => $langs->trans("NoSupplierOrder"),
);
$db->free($result);
} else {
$this->info_box_contents[0][0] = array(
$this->info_box_contents[0][] = array(
'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql),
@ -174,7 +166,7 @@ class box_supplier_orders extends ModeleBoxes
}
else
{
$this->info_box_contents[0][0] = array(
$this->info_box_contents[0][] = array(
'td' => 'align="left" class="nohover opacitymedium"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);

View File

@ -118,7 +118,7 @@ $langs->load("contracts");
if (empty($user->societe_id))
{
$boxstat.='<div class="box">';
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable nohover" width="100%">';
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
$boxstat.='<tr class="liste_titre">';
$boxstat.='<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
$boxstat.='</tr>';
@ -525,7 +525,7 @@ if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($to
//var_dump($totallate);
$boxwork='';
$boxwork.='<div class="box">';
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">'."\n";
$boxwork.='<tr class="liste_titre">';
$boxwork.='<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>';
$boxwork.='</tr>'."\n";

View File

@ -44,7 +44,6 @@ ConfirmActivateService=Are you sure you want to activate this service with date
RefContract=Contract reference
DateContract=Contract date
DateServiceActivate=Service activation date
ShowContract=Show contract
ListOfServices=List of services
ListOfInactiveServices=List of not active services
ListOfExpiredServices=List of expired active services

View File

@ -28,7 +28,6 @@ InterventionClassifyBilled=Classify "Billed"
InterventionClassifyUnBilled=Classify "Unbilled"
InterventionClassifyDone=Classify "Done"
StatusInterInvoiced=Billed
ShowIntervention=Show intervention
SendInterventionRef=Submission of intervention %s
SendInterventionByMail=Send intervention by Email
InterventionCreatedInDolibarr=Intervention %s created

View File

@ -766,6 +766,8 @@ AddBox=Add box
SelectElementAndClick=Select an element and click %s
PrintFile=Print File %s
ShowTransaction=Show entry on bank account
ShowIntervention=Show intervention
ShowContract=Show contract
GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide.
Deny=Deny
Denied=Denied

View File

@ -4469,7 +4469,7 @@ dl.dropdown {
margin-left: 2px;
margin-right: 2px;
padding:0px;
vertical-align: text-bottom;
vertical-align: middle;
display: inline-block;
}
.dropdown dd, .dropdown dt {