dolibarr  9.0.0
mod_supplier_payment_brodator.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  * or see http://www.gnu.org/
17  */
18 
25 require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier_payment.php';
26 
27 
32 {
37  public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
38 
42  public $error = '';
43 
49  public $nom='Brodator';
50 
54  public $name='Brodator';
55 
56 
62  function info()
63  {
64  global $conf, $langs;
65 
66  $langs->load("bills");
67 
68  $form = new Form($this->db);
69 
70  $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
71  $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72  $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73  $texte.= '<input type="hidden" name="action" value="updateMask">';
74  $texte.= '<input type="hidden" name="maskconstsupplierpayment" value="SUPPLIER_PAYMENT_BRODATOR_MASK">';
75  $texte.= '<table class="nobordernopadding" width="100%">';
76 
77  $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
78  $tooltip.=$langs->trans("GenericMaskCodes2");
79  $tooltip.=$langs->trans("GenericMaskCodes3");
80  $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
81  $tooltip.=$langs->trans("GenericMaskCodes5");
82 
83  // Parametrage du prefix
84  $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
85  $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplierpayment" value="'.$conf->global->SUPPLIER_PAYMENT_BRODATOR_MASK.'">',$tooltip,1,1).'</td>';
86 
87  $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88 
89  $texte.= '</tr>';
90 
91  $texte.= '</table>';
92  $texte.= '</form>';
93 
94  return $texte;
95  }
96 
102  function getExample()
103  {
104  global $conf,$langs,$mysoc;
105 
106  $old_code_client=$mysoc->code_client;
107  $mysoc->code_client='CCCCCCCCCC';
108  $numExample = $this->getNextValue($mysoc,'');
109  $mysoc->code_client=$old_code_client;
110 
111  if (! $numExample)
112  {
113  $numExample = $langs->trans('NotConfigured');
114  }
115  return $numExample;
116  }
117 
125  function getNextValue($objsoc,$object)
126  {
127  global $db,$conf;
128 
129  require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
130 
131  // We get cursor rule
132  $mask=$conf->global->SUPPLIER_PAYMENT_BRODATOR_MASK;
133 
134  if (! $mask)
135  {
136  $this->error='NotConfigured';
137  return 0;
138  }
139 
140  $numFinal=get_next_value($db,$mask,'paiementfourn','ref','',$objsoc,$object->datepaye);
141 
142  return $numFinal;
143  }
144 
145 
146  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
154  function commande_get_num($objsoc,$objforref)
155  {
156  // phpcs:enable
157  return $this->getNextValue($objsoc,$objforref);
158  }
159 }
$version
Dolibarr version of the loaded document string.
Class to manage customer payment numbering rules Ant.
getExample()
Renvoi un exemple de numerotation.
commande_get_num($objsoc, $objforref)
Return next free value.
Class to manage generation of HTML components Only common components must be here.
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)
Payment numbering references mother class.
info()
Renvoi la description du modele de numerotation.
getNextValue($objsoc, $object)
Return next free value.