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->rights->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))
85 $sql =
"SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
87 $sql .=
", f.date_valid as datev";
88 $sql .=
", f.tms as datem";
89 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
90 $sql .=
", s.code_client, s.code_compta, s.client";
91 $sql .=
", s.logo, s.email, s.entity";
92 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
93 if (!$user->rights->societe->client->voir) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
94 $sql .=
", ".MAIN_DB_PREFIX.
"fichinter as f";
95 $sql .=
" WHERE f.fk_soc = s.rowid ";
96 $sql .=
" AND f.entity = ".$conf->entity;
97 if (!$user->rights->societe->client->voir && !$user->socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
98 if ($user->socid) $sql .=
" AND s.rowid = ".$user->socid;
99 $sql .=
" ORDER BY f.tms DESC";
100 $sql .= $this->
db->plimit($max, 0);
102 dol_syslog(get_class($this).
'::loadBox', LOG_DEBUG);
113 $objp = $this->
db->fetch_object(
$resql);
114 $datec = $this->
db->jdate($objp->datec);
116 $ficheinterstatic->statut = $objp->status;
117 $ficheinterstatic->status = $objp->status;
118 $ficheinterstatic->id = $objp->rowid;
119 $ficheinterstatic->ref = $objp->ref;
121 $thirdpartystatic->id = $objp->socid;
122 $thirdpartystatic->name = $objp->name;
124 $thirdpartystatic->code_client = $objp->code_client;
125 $thirdpartystatic->code_compta = $objp->code_compta;
126 $thirdpartystatic->client = $objp->client;
127 $thirdpartystatic->logo = $objp->logo;
128 $thirdpartystatic->email = $objp->email;
129 $thirdpartystatic->entity = $objp->entity;
131 $this->info_box_contents[$i][] = array(
132 'td' =>
'class="nowraponall"',
133 'text' => $ficheinterstatic->getNomUrl(1),
137 $this->info_box_contents[$i][] = array(
138 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
139 'text' => $thirdpartystatic->getNomUrl(1),
143 $this->info_box_contents[$i][] = array(
144 'td' =>
'class="right"',
148 $this->info_box_contents[$i][] = array(
149 'td' =>
'class="nowrap right"',
150 'text' => $ficheinterstatic->getLibStatut(3),
157 if ($num == 0) $this->info_box_contents[$i][0] = array(
158 'td' =>
'class="center opacitymedium"',
159 'text'=>$langs->trans(
"NoRecordedInterventions")
164 $this->info_box_contents[0][0] = array(
167 'text' => ($this->
db->error().
' sql='.$sql),
171 $this->info_box_contents[0][0] = array(
172 'td' =>
'class="nohover opacitymedium left"',
173 'text' => $langs->trans(
"ReadPermissionNotAllowed")
186 public function showBox($head = null, $contents = null, $nooutput = 0)
188 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Class to manage interventions.
dol_now($mode= 'auto')
Return date for now.
$conf db
API class for accounts.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
__construct($db, $param)
Constructor.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
loadBox($max=10)
Load data for box to show them later.
Class to manage the box to show last interventions.