28 require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
40 public $version =
'dolibarr';
55 global $db, $conf, $langs;
57 $langs->load(
"bills");
59 $form =
new Form($db);
61 $texte = $langs->trans(
'GenericNumRefModelDesc').
"<br>\n";
62 $texte .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
63 $texte .=
'<input type="hidden" name="token" value="'.newToken().
'">';
64 $texte .=
'<input type="hidden" name="action" value="updateMask">';
65 $texte .=
'<input type="hidden" name="maskconstinvoice" value="FACTURE_MERCURE_MASK_INVOICE">';
66 $texte .=
'<input type="hidden" name="maskconstreplacement" value="FACTURE_MERCURE_MASK_REPLACEMENT">';
67 $texte .=
'<input type="hidden" name="maskconstcredit" value="FACTURE_MERCURE_MASK_CREDIT">';
68 $texte .=
'<input type="hidden" name="maskconstdeposit" value="FACTURE_MERCURE_MASK_DEPOSIT">';
69 $texte .=
'<table class="nobordernopadding" width="100%">';
71 $tooltip = $langs->trans(
"GenericMaskCodes", $langs->transnoentities(
"Invoice"), $langs->transnoentities(
"Invoice"));
72 $tooltip .= $langs->trans(
"GenericMaskCodes2");
73 $tooltip .= $langs->trans(
"GenericMaskCodes3");
74 $tooltip .= $langs->trans(
"GenericMaskCodes4a", $langs->transnoentities(
"Invoice"), $langs->transnoentities(
"Invoice"));
75 $tooltip .= $langs->trans(
"GenericMaskCodes5");
78 $texte .=
'<tr><td>'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceStandard").
'):</td>';
79 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat" size="24" name="maskinvoice" value="'.$conf->global->FACTURE_MERCURE_MASK_INVOICE.
'">', $tooltip, 1, 1).
'</td>';
81 $texte .=
'<td class="left" rowspan="3"> <input type="submit" class="button" value="'.$langs->trans(
"Modify").
'" name="Button"></td>';
86 $texte .=
'<tr><td>'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceReplacement").
'):</td>';
87 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat" size="24" name="maskreplacement" value="'.$conf->global->FACTURE_MERCURE_MASK_REPLACEMENT.
'">', $tooltip, 1, 1).
'</td>';
91 $texte .=
'<tr><td>'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceAvoir").
'):</td>';
92 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat" size="24" name="maskcredit" value="'.$conf->global->FACTURE_MERCURE_MASK_CREDIT.
'">', $tooltip, 1, 1).
'</td>';
96 $texte .=
'<tr><td>'.$langs->trans(
"Mask").
' ('.$langs->trans(
"InvoiceDeposit").
'):</td>';
97 $texte .=
'<td class="right">'.$form->textwithpicto(
'<input type="text" class="flat" size="24" name="maskdeposit" value="'.$conf->global->FACTURE_MERCURE_MASK_DEPOSIT.
'">', $tooltip, 1, 1).
'</td>';
100 $texte .=
'</table>';
113 global $conf, $langs, $mysoc;
115 $old_code_client = $mysoc->code_client;
116 $old_code_type = $mysoc->typent_code;
117 $mysoc->code_client =
'CCCCCCCCCC';
118 $mysoc->typent_code =
'TTTTTTTTTT';
120 $mysoc->code_client = $old_code_client;
121 $mysoc->typent_code = $old_code_type;
125 $numExample =
'NotConfigured';
142 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
146 if (is_object($invoice) && $invoice->type == 1)
148 $mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT;
151 $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
153 } elseif (is_object($invoice) && $invoice->type == 2) $mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT;
154 elseif (is_object($invoice) && $invoice->type == 3) $mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT;
155 else $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE;
158 $this->error =
'NotConfigured';
167 $entity =
getEntity(
'invoicenumber', 1, $invoice);
169 $numFinal =
get_next_value($db, $mask,
'facture',
'ref', $where, $objsoc, $invoice->date, $mode,
false, null, $entity);
170 if (!preg_match(
'/([0-9])+/', $numFinal)) $this->error = $numFinal;
184 public function getNumRef($objsoc, $objforref, $mode =
'next')
getNextValue($objsoc, $invoice, $mode= 'next')
Return next value.
info()
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)
Class of numbering module Mercure for invoices.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
getExample()
Return an example of number value.
Parent class of invoice reference numbering templates.
getNumRef($objsoc, $objforref, $mode= 'next')
Return next free value.