26 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
34 public $boxcode =
"ficheinter";
35 public $boximg =
"object_intervention";
36 public $boxlabel =
"BoxFicheInter";
37 public $depends = array(
"ficheinter");
46 public $info_box_head = array();
47 public $info_box_contents = array();
62 $this->hidden = !($user->hasRight(
'ficheinter',
'lire'));
73 global $user, $langs, $conf;
77 include_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
79 $thirdpartystatic =
new Societe($this->
db);
81 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLastFicheInter", $max));
83 if (!empty($user->rights->ficheinter->lire)) {
84 $sql =
"SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
86 $sql .=
", f.date_valid as datev";
87 $sql .=
", f.tms as datem";
88 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
89 $sql .=
", s.code_client, s.code_compta, s.client";
90 $sql .=
", s.logo, s.email, s.entity";
91 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
92 if (empty($user->rights->societe->client->voir)) {
93 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
95 $sql .=
", ".MAIN_DB_PREFIX.
"fichinter as f";
96 $sql .=
" WHERE f.fk_soc = s.rowid ";
97 $sql .=
" AND f.entity = ".$conf->entity;
98 if (empty($user->rights->societe->client->voir) && !$user->socid) {
99 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
102 $sql .=
" AND s.rowid = ".((int) $user->socid);
104 $sql .=
" ORDER BY f.tms DESC";
105 $sql .= $this->
db->plimit($max, 0);
107 dol_syslog(get_class($this).
'::loadBox', LOG_DEBUG);
116 $objp = $this->
db->fetch_object(
$resql);
117 $datec = $this->
db->jdate($objp->datec);
118 $datem = $this->
db->jdate($objp->datem);
120 $ficheinterstatic->statut = $objp->status;
121 $ficheinterstatic->status = $objp->status;
122 $ficheinterstatic->id = $objp->rowid;
123 $ficheinterstatic->ref = $objp->ref;
125 $thirdpartystatic->id = $objp->socid;
126 $thirdpartystatic->name = $objp->name;
128 $thirdpartystatic->code_client = $objp->code_client;
129 $thirdpartystatic->code_compta = $objp->code_compta;
130 $thirdpartystatic->client = $objp->client;
131 $thirdpartystatic->logo = $objp->logo;
132 $thirdpartystatic->email = $objp->email;
133 $thirdpartystatic->entity = $objp->entity;
135 $this->info_box_contents[$i][] = array(
136 'td' =>
'class="nowraponall"',
137 'text' => $ficheinterstatic->getNomUrl(1),
141 $this->info_box_contents[$i][] = array(
142 'td' =>
'class="tdoverflowmax150"',
143 'text' => $thirdpartystatic->getNomUrl(1),
147 $this->info_box_contents[$i][] = array(
152 $this->info_box_contents[$i][] = array(
153 'td' =>
'class="nowrap right"',
154 'text' => $ficheinterstatic->getLibStatut(3),
162 $this->info_box_contents[$i][0] = array(
163 'td' =>
'class="center opacitymedium"',
164 'text'=>$langs->trans(
"NoRecordedInterventions")
170 $this->info_box_contents[0][0] = array(
173 'text' => ($this->
db->error().
' sql='.$sql),
177 $this->info_box_contents[0][0] = array(
178 'td' =>
'class="nohover opacitymedium left"',
179 'text' => $langs->trans(
"ReadPermissionNotAllowed")
192 public function showBox($head =
null, $contents =
null, $nooutput = 0)
194 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Class to manage interventions.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage the box to show last interventions.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
__construct($db, $param)
Constructor.
loadBox($max=10)
Load data for box to show them later.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.