dolibarr  7.0.0-beta
mod_arctic.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
6  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * or see http://www.gnu.org/
21  */
22 
28 require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php';
29 
34 {
35  var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
36  var $error = '';
37  var $nom = 'arctic';
38 
39 
45  function info()
46  {
47  global $conf,$langs;
48 
49  $langs->load("bills");
50 
51  $form = new Form($this->db);
52 
53  $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
54  $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
55  $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
56  $texte.= '<input type="hidden" name="action" value="updateMask">';
57  $texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
58  $texte.= '<table class="nobordernopadding" width="100%">';
59 
60  $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
61  $tooltip.=$langs->trans("GenericMaskCodes2");
62  $tooltip.=$langs->trans("GenericMaskCodes3");
63  $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
64  $tooltip.=$langs->trans("GenericMaskCodes5");
65 
66  // Parametrage du prefix
67  $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
68  $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>';
69 
70  $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
71 
72  $texte.= '</tr>';
73 
74  $texte.= '</table>';
75  $texte.= '</form>';
76 
77  return $texte;
78  }
79 
85  function getExample()
86  {
87  global $conf,$langs,$mysoc;
88 
89  $old_code_client=$mysoc->code_client;
90  $mysoc->code_client='CCCCCCCCCC';
91  $numExample = $this->getNextValue($mysoc,'');
92  $mysoc->code_client=$old_code_client;
93 
94  if (! $numExample)
95  {
96  $numExample = $langs->trans('NotConfigured');
97  }
98  return $numExample;
99  }
100 
108  function getNextValue($objsoc=0,$object='')
109  {
110  global $db,$conf;
111 
112  require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
113 
114  // On d�fini critere recherche compteur
115  $mask=$conf->global->FICHINTER_ARTIC_MASK;
116 
117  if (! $mask)
118  {
119  $this->error='NotConfigured';
120  return 0;
121  }
122 
123  $numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec);
124 
125  return $numFinal;
126  }
127 
128 
136  function getNumRef($objsoc,$objforref)
137  {
138  return $this->getNextValue($objsoc,$objforref);
139  }
140 
141 }
142 
Class to manage numbering of intervention cards with rule Artic.
Definition: mod_arctic.php:33
info()
Renvoi la description du modele de numerotation.
Definition: mod_arctic.php:45
getNextValue($objsoc=0, $object='')
Return next free value.
Definition: mod_arctic.php:108
getNextValue()
Renvoi prochaine valeur attribuee.
if(empty($reshook)) $form
View.
Definition: perms.php:103
getExample()
Renvoi un exemple de numerotation.
Definition: mod_arctic.php:85
Class to manage generation of HTML components Only common components must be here.
Classe mere des modeles de numerotation des references de fiches d'intervention.
getNumRef($objsoc, $objforref)
Return next free value.
Definition: mod_arctic.php:136
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)