dolibarr  7.0.0-beta
mod_expedition_ribera.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2011 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/expedition/modules_expedition.php';
26 
31 {
32  var $version='dolibarr';
33  var $error = '';
34  var $nom = 'Ribera';
35 
41  function info()
42  {
43  global $conf,$langs;
44 
45  $langs->load("bills");
46 
47  $form = new Form($this->db);
48 
49  $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
50  $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51  $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52  $texte.= '<input type="hidden" name="action" value="updateMask">';
53  $texte.= '<input type="hidden" name="maskconstexpedition" value="EXPEDITION_RIBERA_MASK">';
54  $texte.= '<table class="nobordernopadding" width="100%">';
55 
56  $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Shipment"),$langs->transnoentities("Shipment"));
57  $tooltip.=$langs->trans("GenericMaskCodes2");
58  $tooltip.=$langs->trans("GenericMaskCodes3");
59  $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Shipment"),$langs->transnoentities("Shipment"));
60  $tooltip.=$langs->trans("GenericMaskCodes5");
61 
62  $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
63  $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskexpedition" value="'.$conf->global->EXPEDITION_RIBERA_MASK.'">',$tooltip,1,1).'</td>';
64  $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65  $texte.= '</tr>';
66  $texte.= '</table>';
67  $texte.= '</form>';
68 
69  return $texte;
70  }
71 
77  function getExample()
78  {
79  global $conf,$langs,$mysoc;
80 
81  $old_code_client=$mysoc->code_client;
82  $old_code_type=$mysoc->typent_code;
83  $mysoc->code_client='CCCCCCCCCC';
84  $mysoc->typent_code='TTTTTTTTTT';
85  $numExample = $this->getNextValue($mysoc,'');
86  $mysoc->code_client=$old_code_client;
87  $mysoc->typent_code=$old_code_type;
88 
89  if (! $numExample)
90  {
91  $numExample = $langs->trans('NotConfigured');
92  }
93  return $numExample;
94  }
95 
103  function getNextValue($objsoc,$shipment)
104  {
105  global $db,$conf;
106 
107  require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
108 
109  $mask=$conf->global->EXPEDITION_RIBERA_MASK;
110 
111  if (! $mask)
112  {
113  $this->error='NotConfigured';
114  return 0;
115  }
116 
117  $date = $shipment->date_expedition;
118 
119  $numFinal=get_next_value($db,$mask,'expedition','ref','',$objsoc,$date);
120 
121  return $numFinal;
122  }
123 
131  function expedition_get_num($objsoc,$objforref)
132  {
133  return $this->getNextValue($objsoc,$objforref);
134  }
135 
136 }
137 
Class to manage expedition numbering rules Ribera.
getExample()
Return numbering example.
if(empty($reshook)) $form
View.
Definition: perms.php:103
Parent Class of numbering models of sending receipts references.
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)
Return last or next value for a mask (according to area we should not reset)
expedition_get_num($objsoc, $objforref)
Return next free value.
info()
Return default description of numbering model.
getNextValue($objsoc, $shipment)
Return next value.