28require_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
38 public $module =
'webportal';
53 protected $invoice_static =
null;
98 public $fields = array(
99 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'position' => 1,),
100 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'default' =>
'1',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'position' => 20,
'index' => 1,),
101 'ref' => array(
'type' =>
'varchar(30)',
'label' =>
'Ref',
'enabled' => 1,
'visible' => 2,
'notnull' => 1,
'showoncombobox' => 1,
'position' => 5,),
102 'type' => array(
'type' =>
'smallint(6)',
'label' =>
'Type',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'position' => 15,),
103 'datef' => array(
'type' =>
'date',
'label' =>
'DateInvoice',
'enabled' => 1,
'visible' => 2,
'position' => 20,),
104 'date_lim_reglement' => array(
'type' =>
'date',
'label' =>
'DateDue',
'enabled' => 1,
'visible' => 2,
'position' => 25,),
105 'paye' => array(
'type' =>
'smallint(6)',
'label' =>
'InvoicePaidCompletely',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'position' => 80,),
106 'total_ht' => array(
'type' =>
'price',
'label' =>
'AmountHT',
'enabled' => 1,
'visible' => 2,
'position' => 95,
'isameasure' => 1,),
107 'total_tva' => array(
'type' =>
'price',
'label' =>
'AmountVAT',
'enabled' => 1,
'visible' => 2,
'position' => 100,
'isameasure' => 1,),
108 'total_ttc' => array(
'type' =>
'price',
'label' =>
'AmountTTC',
'enabled' => 1,
'visible' => 2,
'position' => 130,
'isameasure' => 1,),
109 'multicurrency_total_ht' => array(
'type' =>
'price',
'label' =>
'MulticurrencyAmountHT',
'enabled' =>
'isModEnabled("multicurrency")',
'visible' => -2,
'position' => 290,
'isameasure' => 1,),
110 'multicurrency_total_tva' => array(
'type' =>
'price',
'label' =>
'MulticurrencyAmountVAT',
'enabled' =>
'isModEnabled("multicurrency")',
'visible' => -2,
'position' => 291,
'isameasure' => 1,),
111 'multicurrency_total_ttc' => array(
'type' =>
'price',
'label' =>
'MulticurrencyAmountTTC',
'enabled' =>
'isModEnabled("multicurrency")',
'visible' => -2,
'position' => 292,
'isameasure' => 1,),
112 'fk_statut' => array(
'type' =>
'smallint(6)',
'label' =>
'Status',
'enabled' => 1,
'visible' => 2,
'notnull' => 1,
'position' => 1000,
'arrayofkeyval' => self::ARRAY_STATUS_LABEL,),
135 if (!$this->invoice_static) {
136 $this->invoice_static =
new Facture($this->db);
139 return $this->invoice_static;
151 $this->isextrafieldmanaged = 0;
167 $langs->load(
'bills');
188 public function getNomUrl($withpicto = 0, $option =
'', $max = 0, $short = 0, $moretitle =
'', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target =
'')
190 global $langs, $conf;
192 if (!empty($conf->dol_no_mouse_hover)) {
205 $picto = $this->picto;
206 if ($this->
type == self::TYPE_REPLACEMENT) {
209 if ($this->
type == self::TYPE_CREDIT_NOTE) {
212 if ($this->
type == self::TYPE_DEPOSIT) {
217 'objecttype' => $this->element,
218 'moretitle' => $moretitle,
221 $classfortooltip =
'classfortooltip';
224 $classfortooltip =
'classforajaxtooltip';
231 $linkclose = ($target ?
' target="' . $target .
'"' :
'');
233 $linkstart =
'<a href="' . $url .
'"';
234 $linkstart .= $linkclose .
'>';
237 if ($option ==
'nolink') {
242 $result .= $linkstart;
244 $result .=
img_object(($notooltip ?
'' : $label), $picto, ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') : $dataparams .
' class="' . (($withpicto != 2) ?
'paddingright ' :
'') . $classfortooltip .
'"'), 0, 0, $notooltip ? 0 : 1);
246 if ($withpicto != 2) {
247 $result .= ($max ?
dol_trunc($this->
ref, $max) : $this->ref);
251 global $action, $hookmanager;
252 $hookmanager->initHooks(array(
'invoicedao'));
253 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result,
'notooltip' => $notooltip,
'addlinktonotes' => $addlinktonotes,
'save_lastsearch_value' => $save_lastsearch_value,
'target' => $target);
254 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
256 $result = $hookmanager->resPrint;
258 $result .= $hookmanager->resPrint;
273 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
275 $return =
'<div class="box-flex-item box-flex-grow-zero">';
276 $return .=
'<div class="info-box info-box-sm">';
277 $return .=
'<span class="info-box-icon bg-infobox-action">';
280 $return .=
'</span>';
281 $return .=
'<div class="info-box-content">';
282 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref) .
'</span>';
283 $return .=
'<input id="cb' . $this->
id .
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->
id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
284 if (property_exists($this,
'socid')) {
285 $return .=
'<br><span class="info-box-label">' . $this->socid .
'</span>';
287 if (property_exists($this,
'fk_user_author')) {
288 $return .=
'<br><span class="info-box-label">' . $this->fk_user_author .
'</span>';
290 if (method_exists($this,
'getLibStatut')) {
291 $return .=
'<br><div class="info-box-status margintoponly">' . $this->
getLibStatut(3) .
'</div>';
308 return $this->
LibStatut($this->paye, $this->fk_statut, $mode, -1, $this->
type);
320 return $this->
LibStatut($this->paye, $this->fk_statut, $mode, $alreadypaid, $this->
type);
335 public function LibStatut(
$paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
Class to manage Dolibarr database access.
Class to manage invoices.
const STATUS_DRAFT
Draft status.
$paye
1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
const STATUS_VALIDATED
Validated (need to be paid)
const STATUS_ABANDONED
Classified abandoned and no payment done.
const STATUS_CLOSED
Classified paid.
Class for WebPortalInvoice.
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
__construct(DoliDB $db)
Constructor.
getInvoiceStatic()
Get invoice for static methods.
LibStatut($paye, $status, $mode=0, $alreadypaid=-1, $type=-1)
Return label of a status.
getLibStatut($mode=0, $alreadypaid=-1)
Return label of object status.
const ARRAY_STATUS_LABEL
Status list (short label)
getLabelStatus($mode=0)
Return the label of the status.
getNomUrl($withpicto=0, $option='', $max=0, $short=0, $moretitle='', $notooltip=0, $addlinktonotes=0, $save_lastsearch_value=-1, $target='')
Return clicable link of object (with eventually picto)
getTooltipContentArray($params)
getTooltipContentArray
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type