Qual: Supprime module numérotation pluton qui fait doublon avec neptune
This commit is contained in:
parent
cfb4537850
commit
8a598504af
@ -62,9 +62,10 @@ class mod_facture_neptune extends ModeleNumRefFactures
|
|||||||
*/
|
*/
|
||||||
function getExample()
|
function getExample()
|
||||||
{
|
{
|
||||||
if (defined("FACTURE_NEPTUNE_DELTA"))
|
global $conf;
|
||||||
|
if ($conf->global->FACTURE_NEPTUNE_DELTA)
|
||||||
{
|
{
|
||||||
return "FA0400".sprintf("%02d",FACTURE_NEPTUNE_DELTA);
|
return "FA04".sprintf("%04d",$conf->global->FACTURE_NEPTUNE_DELTA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -72,34 +73,57 @@ class mod_facture_neptune extends ModeleNumRefFactures
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief Renvoie la référence de facture suivante non utilisée
|
||||||
|
* \param objsoc Objet société
|
||||||
|
* \return string Texte descripif
|
||||||
|
*/
|
||||||
|
function getNextValue($objsoc=0)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
// D'abord on récupère la valeur max (réponse immédiate car champ indéxé)
|
||||||
|
$fayy='';
|
||||||
|
$sql = "SELECT MAX(facnumber)";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
if ($row) $fayy = substr($row[0],0,4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si champ respectant le modèle a été trouvée
|
||||||
|
if (eregi('^FA[0-9][0-9]',$fayy))
|
||||||
|
{
|
||||||
|
// Recherche rapide car restreint par un like sur champ indexé
|
||||||
|
$posindice=5;
|
||||||
|
$sql = "SELECT MAX(0+SUBSTRING(facnumber,$posindice))";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
|
$sql.= " WHERE facnumber like '${fayy}%'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
$max = $row[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$max=$conf->global->FACTURE_NEPTUNE_DELTA?$conf->global->FACTURE_NEPTUNE_DELTA:0;
|
||||||
|
}
|
||||||
|
$yy = strftime("%y",time());
|
||||||
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
|
return "FA$yy$num";
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief Renvoie la référence de facture suivante non utilisée
|
/** \brief Renvoie la référence de facture suivante non utilisée
|
||||||
* \param objsoc Objet société
|
* \param objsoc Objet société
|
||||||
* \return string Texte descripif
|
* \return string Texte descripif
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc=0)
|
function getNumRef($objsoc=0)
|
||||||
{
|
{
|
||||||
global $db;
|
return $this->getNextValue($objsoc);
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0";
|
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
|
||||||
$row = $db->fetch_row(0);
|
|
||||||
|
|
||||||
$num = $row[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defined("FACTURE_NEPTUNE_DELTA"))
|
|
||||||
{
|
|
||||||
define("FACTURE_NEPTUNE_DELTA", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$num = $num + FACTURE_NEPTUNE_DELTA;
|
|
||||||
|
|
||||||
$y = strftime("%y",time());
|
|
||||||
|
|
||||||
return "FA" . "$y" . substr("000".$num, strlen("000".$num)-4,4);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,84 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (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
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \file htdocs/includes/modules/facture/pluton/pluton.modules.php
|
|
||||||
\ingroup facture
|
|
||||||
\brief Fichier contenant la classe du modèle de numérotation de référence de facture Pluton
|
|
||||||
\version $Revision$
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
|
||||||
|
|
||||||
/*! \class mod_facture_pluton
|
|
||||||
\brief Classe du modèle de numérotation de référence de facture Pluton
|
|
||||||
*/
|
|
||||||
|
|
||||||
class mod_facture_pluton extends ModeleNumRefFactures
|
|
||||||
{
|
|
||||||
|
|
||||||
/*! \brief Renvoi la description du modele de numérotation
|
|
||||||
* \return string Texte descripif
|
|
||||||
*/
|
|
||||||
function info()
|
|
||||||
{
|
|
||||||
return '
|
|
||||||
Renvoie le numéro de facture sous une forme numérique simple, la première facture porte le numéro 1, la quinzième facture ayant le numéro 15.';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! \brief Renvoi un exemple de numérotation
|
|
||||||
* \return string Example
|
|
||||||
*/
|
|
||||||
function getExample()
|
|
||||||
{
|
|
||||||
return "FA040001";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! \brief Renvoie la référence de facture suivante non utilisée
|
|
||||||
* \param objsoc Objet société
|
|
||||||
* \return string Texte descripif
|
|
||||||
*/
|
|
||||||
function getNumRef($objsoc=0)
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0";
|
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
|
||||||
$row = $db->fetch_row(0);
|
|
||||||
|
|
||||||
$num = $row[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$y = strftime("%y",time());
|
|
||||||
|
|
||||||
return "FA" . "$y" . substr("000".$num, strlen("000".$num)-4,4);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -98,8 +98,8 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
if ($row) $fayymm = substr($row[0],0,6);
|
if ($row) $fayymm = substr($row[0],0,6);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si au moins un champ respectant le modèle a été trouvée
|
// Si champ respectant le modèle a été trouvée
|
||||||
if (eregi('FA[0-9][0-9][0-9][0-9]',$fayymm))
|
if (eregi('^FA[0-9][0-9][0-9][0-9]',$fayymm))
|
||||||
{
|
{
|
||||||
// Recherche rapide car restreint par un like sur champ indexé
|
// Recherche rapide car restreint par un like sur champ indexé
|
||||||
$posindice=8;
|
$posindice=8;
|
||||||
|
|||||||
@ -158,3 +158,6 @@ insert into llx_document_model(nom,type) values('rouget','shipping');
|
|||||||
delete from llx_document_model where nom='adytek';
|
delete from llx_document_model where nom='adytek';
|
||||||
delete from llx_document_model where nom='rouge' and type='order';
|
delete from llx_document_model where nom='rouge' and type='order';
|
||||||
delete from llx_document_model where nom='azur' and type='order';
|
delete from llx_document_model where nom='azur' and type='order';
|
||||||
|
|
||||||
|
|
||||||
|
update llx_const set value='neptune' where value='pluton' and name = 'FACTURE_ADDON';
|
||||||
Loading…
Reference in New Issue
Block a user