29require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
41 public $version =
'dolibarr';
55 public function info($langs)
59 $langs->load(
"bills");
61 $form =
new Form($db);
63 $texte = $langs->trans(
'GenericNumRefModelDesc').
"<br>\n";
64 $texte .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
65 $texte .=
'<input type="hidden" name="token" value="'.newToken().
'">';
66 $texte .=
'<input type="hidden" name="action" value="updateMask">';
67 $texte .=
'<input type="hidden" name="maskconstinvoice" value="FACTURE_MERCURE_MASK_INVOICE">';
68 $texte .=
'<input type="hidden" name="maskconstreplacement" value="FACTURE_MERCURE_MASK_REPLACEMENT">';
69 $texte .=
'<input type="hidden" name="maskconstcredit" value="FACTURE_MERCURE_MASK_CREDIT">';
70 $texte .=
'<input type="hidden" name="maskconstdeposit" value="FACTURE_MERCURE_MASK_DEPOSIT">';
71 $texte .=
'<table class="nobordernopadding" width="100%">';
73 $tooltip = $langs->trans(
"GenericMaskCodes", $langs->transnoentities(
"Invoice"), $langs->transnoentities(
"Invoice"));
74 $tooltip .= $langs->trans(
"GenericMaskCodes2");
75 $tooltip .= $langs->trans(
"GenericMaskCodes3");
76 $tooltip .= $langs->trans(
"GenericMaskCodes4a", $langs->transnoentities(
"Invoice"), $langs->transnoentities(
"Invoice"));
77 $tooltip .= $langs->trans(
"GenericMaskCodes5");
80 $texte .=
'<tr><td><span class="opacitymedium">'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceStandard").
'):</span></td>';
81 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat minwidth175" name="maskinvoice" value="'.
getDolGlobalString(
"FACTURE_MERCURE_MASK_INVOICE").
'">', $tooltip, 1, 1).
'</td>';
83 $texte .=
'<td class="left" rowspan="3"> <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans(
"Modify").
'"></td>';
88 $texte .=
'<tr><td><span class="opacitymedium">'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceReplacement").
'):</span></td>';
89 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat minwidth175" name="maskreplacement" value="'.
getDolGlobalString(
"FACTURE_MERCURE_MASK_REPLACEMENT").
'">', $tooltip, 1, 1).
'</td>';
93 $texte .=
'<tr><td><span class="opacitymedium">'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceAvoir").
'):</span></td>';
94 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat minwidth175" name="maskcredit" value="'.
getDolGlobalString(
"FACTURE_MERCURE_MASK_CREDIT").
'">', $tooltip, 1, 1).
'</td>';
98 $texte .=
'<tr><td><span class="opacitymedium">'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceDeposit").
'):</span></td>';
99 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat minwidth175" name="maskdeposit" value="'.
getDolGlobalString(
"FACTURE_MERCURE_MASK_DEPOSIT").
'">', $tooltip, 1, 1).
'</td>';
102 $texte .=
'</table>';
117 $old_code_client = $mysoc->code_client;
118 $old_code_type = $mysoc->typent_code;
119 $mysoc->code_client =
'CCCCCCCCCC';
120 $mysoc->typent_code =
'TTTTTTTTTT';
122 $mysoc->code_client = $old_code_client;
123 $mysoc->typent_code = $old_code_type;
126 $numExample =
'NotConfigured';
143 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
147 if (is_object($invoice) && $invoice->type == 1) {
149 } elseif (is_object($invoice) && $invoice->type == 2) {
151 } elseif (is_object($invoice) && $invoice->type == 3) {
157 $this->error =
'NotConfigured';
166 $entity =
getEntity(
'invoicenumber', 1, $invoice);
168 $numFinal =
get_next_value($db, $mask,
'facture',
'ref', $where, $objsoc, $invoice->date, $mode,
false,
null, $entity);
169 if (!preg_match(
'/([0-9])+/', $numFinal)) {
170 $this->error = $numFinal;
185 public function getNumRef($objsoc, $objforref, $mode =
'next')
Parent class of invoice reference numbering templates.
Class of numbering module Mercure for invoices.
getNextValue($objsoc, $invoice, $mode='next')
Return next value.
getExample()
Return an example of number value.
getNumRef($objsoc, $objforref, $mode='next')
Return next free value.
info($langs)
Returns the description of the numbering model.
get_next_value($db, $mask, $table, $field, $where='', $objsoc='', $date='', $mode='next', $bentityon=true, $objuser=null, $forceentity=null)
Return last or next value for a mask (according to area we should not reset)
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.