2007-05-28 14:31:30 +00:00
|
|
|
|
<?php
|
2009-05-02 14:26:54 +00:00
|
|
|
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 14:13:49 +00:00
|
|
|
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
2009-05-02 14:26:54 +00:00
|
|
|
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
2013-08-27 07:44:00 +00:00
|
|
|
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
2007-05-28 14:31:30 +00:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 14:36:08 +00:00
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2007-05-28 14:31:30 +00:00
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2011-07-31 23:24:38 +00:00
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2007-05-28 14:31:30 +00:00
|
|
|
|
* or see http://www.gnu.org/
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-10-24 12:11:49 +00:00
|
|
|
|
* \file htdocs/core/modules/fichinter/mod_arctic.php
|
2010-07-21 11:57:52 +00:00
|
|
|
|
* \ingroup fiche intervention
|
2011-07-02 15:46:02 +00:00
|
|
|
|
* \brief File with Arctic numbering module for interventions
|
2010-07-21 11:57:52 +00:00
|
|
|
|
*/
|
2012-08-22 21:11:24 +00:00
|
|
|
|
require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php';
|
2007-05-28 14:31:30 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
2012-02-16 17:39:22 +00:00
|
|
|
|
* Class to manage numbering of intervention cards with rule Artic.
|
2010-07-21 11:57:52 +00:00
|
|
|
|
*/
|
2007-05-28 14:31:30 +00:00
|
|
|
|
class mod_arctic extends ModeleNumRefFicheinter
|
|
|
|
|
|
{
|
2008-03-20 21:45:44 +00:00
|
|
|
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
2007-05-28 14:31:30 +00:00
|
|
|
|
var $error = '';
|
2012-03-14 10:49:11 +00:00
|
|
|
|
var $nom = 'arctic';
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2007-05-28 14:31:30 +00:00
|
|
|
|
|
2012-03-14 10:49:11 +00:00
|
|
|
|
/**
|
2012-02-16 17:39:22 +00:00
|
|
|
|
* Renvoi la description du modele de numerotation
|
2012-03-14 10:49:11 +00:00
|
|
|
|
*
|
2012-02-16 17:39:22 +00:00
|
|
|
|
* @return string Texte descripif
|
2007-05-28 14:31:30 +00:00
|
|
|
|
*/
|
2008-03-20 21:45:44 +00:00
|
|
|
|
function info()
|
2007-05-28 14:31:30 +00:00
|
|
|
|
{
|
|
|
|
|
|
global $conf,$langs;
|
|
|
|
|
|
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$langs->load("bills");
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2011-12-05 18:03:36 +00:00
|
|
|
|
$form = new Form($this->db);
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
|
|
|
|
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
2009-05-17 08:01:54 +00:00
|
|
|
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
|
|
|
|
|
$texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">';
|
|
|
|
|
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2011-12-04 09:57:22 +00:00
|
|
|
|
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
|
2009-01-31 15:23:05 +00:00
|
|
|
|
$tooltip.=$langs->trans("GenericMaskCodes2");
|
|
|
|
|
|
$tooltip.=$langs->trans("GenericMaskCodes3");
|
|
|
|
|
|
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard"));
|
|
|
|
|
|
$tooltip.=$langs->trans("GenericMaskCodes5");
|
|
|
|
|
|
|
|
|
|
|
|
// Parametrage du prefix
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
2009-05-04 19:02:32 +00:00
|
|
|
|
$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>';
|
2007-05-28 14:31:30 +00:00
|
|
|
|
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
|
|
|
|
|
|
|
|
|
|
|
$texte.= '</tr>';
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$texte.= '</table>';
|
|
|
|
|
|
$texte.= '</form>';
|
|
|
|
|
|
|
|
|
|
|
|
return $texte;
|
2007-05-28 14:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-02-16 17:39:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Renvoi un exemple de numerotation
|
2012-03-14 10:49:11 +00:00
|
|
|
|
*
|
2012-02-16 17:39:22 +00:00
|
|
|
|
* @return string Example
|
2007-05-28 14:31:30 +00:00
|
|
|
|
*/
|
|
|
|
|
|
function getExample()
|
|
|
|
|
|
{
|
2008-03-20 21:45:44 +00:00
|
|
|
|
global $conf,$langs,$mysoc;
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2008-06-20 21:10:24 +00:00
|
|
|
|
$old_code_client=$mysoc->code_client;
|
|
|
|
|
|
$mysoc->code_client='CCCCCCCCCC';
|
|
|
|
|
|
$numExample = $this->getNextValue($mysoc,'');
|
|
|
|
|
|
$mysoc->code_client=$old_code_client;
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2008-03-20 21:45:44 +00:00
|
|
|
|
if (! $numExample)
|
|
|
|
|
|
{
|
|
|
|
|
|
$numExample = $langs->trans('NotConfigured');
|
|
|
|
|
|
}
|
|
|
|
|
|
return $numExample;
|
2007-05-28 14:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-02-16 17:39:22 +00:00
|
|
|
|
/**
|
2012-03-14 10:49:11 +00:00
|
|
|
|
* Return next free value
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param Societe $objsoc Object thirdparty
|
|
|
|
|
|
* @param Object $object Object we need next value for
|
|
|
|
|
|
* @return string Value if KO, <0 if KO
|
2012-02-16 17:39:22 +00:00
|
|
|
|
*/
|
2011-07-02 15:46:02 +00:00
|
|
|
|
function getNextValue($objsoc=0,$object='')
|
2007-05-28 14:31:30 +00:00
|
|
|
|
{
|
2008-03-20 21:45:44 +00:00
|
|
|
|
global $db,$conf;
|
2007-05-28 14:31:30 +00:00
|
|
|
|
|
2012-08-22 21:11:24 +00:00
|
|
|
|
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2010-07-21 11:57:52 +00:00
|
|
|
|
// On d<>fini critere recherche compteur
|
2008-03-20 21:45:44 +00:00
|
|
|
|
$mask=$conf->global->FICHINTER_ARTIC_MASK;
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
|
|
|
|
|
if (! $mask)
|
2008-03-20 21:45:44 +00:00
|
|
|
|
{
|
|
|
|
|
|
$this->error='NotConfigured';
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-27 07:44:00 +00:00
|
|
|
|
$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc->code_client,$object->datec);
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
2008-03-20 21:45:44 +00:00
|
|
|
|
return $numFinal;
|
2007-05-28 14:31:30 +00:00
|
|
|
|
}
|
2009-01-31 15:23:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
2012-02-16 17:39:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Return next free value
|
2012-03-14 10:49:11 +00:00
|
|
|
|
*
|
2012-02-16 17:39:22 +00:00
|
|
|
|
* @param Societe $objsoc Object third party
|
|
|
|
|
|
* @param Object $objforref Object for number to search
|
|
|
|
|
|
* @return string Next free value
|
|
|
|
|
|
*/
|
2008-07-05 14:20:03 +00:00
|
|
|
|
function getNumRef($objsoc,$objforref)
|
2007-05-28 14:31:30 +00:00
|
|
|
|
{
|
2008-07-05 14:20:03 +00:00
|
|
|
|
return $this->getNextValue($objsoc,$objforref);
|
2007-05-28 14:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2009-01-31 15:23:05 +00:00
|
|
|
|
}
|
2007-05-28 14:31:30 +00:00
|
|
|
|
|
|
|
|
|
|
?>
|