New: La numrotation des factures de doit et des factures avoirs peut etre dissocies selon choix du module de numrotation.
This commit is contained in:
parent
0d20bf6bbc
commit
78d0bc8867
@ -241,12 +241,21 @@ while (($file = readdir($handle))!==false)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$facture=new Facture($db);
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue($mysoc,'');
|
||||
$facture->type=0;
|
||||
$nextval=$module->getNextValue($mysoc,$facture);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
$htmltooltip.='<b>'.$langs->trans("NextValueForInvoices").'</b>: '.$nextval.'<br>';
|
||||
}
|
||||
$facture->type=2;
|
||||
$nextval=$module->getNextValue($mysoc,$facture);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip.='<b>'.$langs->trans("NextValueForCreditNotes").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
|
||||
@ -166,7 +166,7 @@ if ($handle)
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue();
|
||||
$nextval=$module->getNextValue($mysoc);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
|
||||
@ -165,7 +165,7 @@ if ($handle)
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue();
|
||||
$nextval=$module->getNextValue($mysoc);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
|
||||
@ -187,7 +187,7 @@ if ($handle)
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue();
|
||||
$nextval=$module->getNextValue($mysoc);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
|
||||
@ -218,7 +218,7 @@ if ($handle)
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue();
|
||||
$nextval=$module->getNextValue($mysoc);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -91,48 +91,49 @@ class ModelePDFFactures extends FPDF
|
||||
\class ModeleNumRefFactures
|
||||
\brief Classe mère des modèles de numérotation des références de facture
|
||||
*/
|
||||
|
||||
class ModeleNumRefFactures
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \param objsoc Objet societe
|
||||
* \param facture Objet facture
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue($objsoc,$facture)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -82,7 +81,7 @@ class mod_facture_neptune extends ModeleNumRefFactures
|
||||
* \param facture Objet facture
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function getNextValue($objsoc=0,$facture)
|
||||
function getNextValue($objsoc,$facture)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -36,7 +36,8 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php")
|
||||
|
||||
class mod_facture_terre extends ModeleNumRefFactures
|
||||
{
|
||||
var $prefix='FA';
|
||||
var $prefixinvoice='FA';
|
||||
var $prefixcreditnote='AV';
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description du modele de numérotation
|
||||
@ -48,7 +49,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
return $langs->trans('TerreNumRefModelDesc1',$this->prefix);
|
||||
return $langs->trans('TerreNumRefModelDesc1',$this->prefixinvoice,$this->prefixcreditnote);
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
@ -56,7 +57,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
return $this->prefixinvoice."0501-0001";
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
@ -67,41 +68,65 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("bills");
|
||||
|
||||
$fayymm='';
|
||||
// Check invoice num
|
||||
$fayymm='';
|
||||
|
||||
$sql = "SELECT MAX(facnumber)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE facnumber like '".$this->prefixinvoice."%'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) $fayymm = substr($row[0],0,6);
|
||||
}
|
||||
if (! $fayymm || eregi($this->prefix.'[0-9][0-9][0-9][0-9]',$fayymm))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if ($fayymm && eregi($this->prefixinvoice.'[0-9][0-9][0-9][0-9]',$fayymm))
|
||||
{
|
||||
$this->error=$langs->trans('TerreNumRefModelError');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check credit note num
|
||||
$fayymm='';
|
||||
|
||||
$sql = "SELECT MAX(facnumber)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE facnumber like '".$this->prefixcreditnote."%'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) $fayymm = substr($row[0],0,6);
|
||||
}
|
||||
if ($fayymm && eregi($this->prefixcreditnote.'[0-9][0-9][0-9][0-9]',$fayymm))
|
||||
{
|
||||
$this->error=$langs->trans('TerreNumRefModelError');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \param objsoc Objet societe
|
||||
* \param facture Objet facture
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue($facture)
|
||||
function getNextValue($objsoc,$facture)
|
||||
{
|
||||
global $db;
|
||||
|
||||
if ($facture->type == 2) $prefix=$this->prefixcreditnote;
|
||||
else $prefix=$this->prefixinvoice;
|
||||
|
||||
// D'abord on récupère la valeur max (réponse immédiate car champ indéxé)
|
||||
$fayymm='';
|
||||
$sql = "SELECT MAX(facnumber)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE facnumber like '".$prefix."%'";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -115,7 +140,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
}
|
||||
|
||||
// Si champ respectant le modèle a été trouvée
|
||||
if (eregi('^'.$this->prefix.'[0-9][0-9][0-9][0-9]',$fayymm))
|
||||
if (eregi('^'.$prefix.'[0-9][0-9][0-9][0-9]',$fayymm))
|
||||
{
|
||||
// Recherche rapide car restreint par un like sur champ indexé
|
||||
$posindice=8;
|
||||
@ -136,8 +161,8 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
$yymm = strftime("%y%m",time());
|
||||
$num = sprintf("%04s",$max+1);
|
||||
|
||||
dolibarr_syslog("mod_facture_terre::getNextValue return ".$this->prefix."$yymm-$num");
|
||||
return $this->prefix."$yymm-$num";
|
||||
dolibarr_syslog("mod_facture_terre::getNextValue return ".$prefix."$yymm-$num");
|
||||
return $prefix."$yymm-$num";
|
||||
}
|
||||
|
||||
/** \brief Renvoie la référence de facture suivante non utilisée
|
||||
@ -147,7 +172,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
*/
|
||||
function getNumRef($objsoc=0,$facture)
|
||||
{
|
||||
return $this->getNextValue($facture);
|
||||
return $this->getNextValue($objsoc,$facture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ NotAvailableWhenAjaxDisabled=Not available when Ajax disabled
|
||||
JavascriptDisabled=Javascript disabled
|
||||
UsePopupCalendar=Use popup for dates input
|
||||
NextValue=Next value
|
||||
NextValueForInvoices=Next value (invoices)
|
||||
NextValueForCreditNotes=Next value (credit notes)
|
||||
MustBeLowerThanPHPLimit=Note: your PHP limits upload size to <b>%s</b> %s, whatever is thi sparameter value
|
||||
NoMaxSizeByPHPLimit=Note: No limit are built in your PHP
|
||||
ComptaSetup=Accounting module setup
|
||||
|
||||
@ -14,9 +14,9 @@ InvoiceStandardDesc=This kind of invoice is the common invoice.
|
||||
InvoiceReplacement=Replacement invoice. Must replace invoice with reference
|
||||
InvoiceReplacementAsk=Replacement invoice for invoice
|
||||
InvoiceReplacementDesc=<b>Replacement invoice</b> is used to cancel and replace completely an invoice with no paiement already recevided.<br>Reference of canceled invoice is required.
|
||||
InvoiceAvoir=Avoir invoice
|
||||
InvoiceAvoirAsk=Avoir invoice to correct invoice
|
||||
InvoiceAvoirDesc=La <b>facture d'avoir</b> est une facture négative destinée à compenser une facture comportant un montant supérieur à ce qui a été ou sera réellement payé (toutes causes possibles).
|
||||
InvoiceAvoir=Credit note
|
||||
InvoiceAvoirAsk=Credit note to correct invoice
|
||||
InvoiceAvoirDesc=The <b>credit note</b> is a negative invoice used to solve fact that an invoice has an higher amount that amount that was or will be payed (all possible reasons).
|
||||
ReplaceInvoice=Replace invoice %s
|
||||
ReplacedByInvoice=Replaced by invoice %s
|
||||
CorrectInvoice=Correct invoice %s
|
||||
@ -119,7 +119,7 @@ ConfirmClassifyPayedPartiallyReasonDiscountVat=Remainder to pay <b>(%s %s)</b> i
|
||||
ConfirmClassifyPayedPartiallyReasonAbandon=Debit irremediably not recoverable (bad customer...)
|
||||
ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: « escompte net de taxe »)
|
||||
ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
|
||||
ConfirmClassifyPayedPartiallyAvoir=Ce choix est le choix à prendre si les autres ne sont pas applicables
|
||||
ConfirmClassifyPayedPartiallyAvoir=Use this choice if all other does not suit
|
||||
ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement
|
||||
ConfirmCustomerPayment=Do you confirm this paiement input for <b>%s</b> %s ?
|
||||
ValidateBill=Validate invoice
|
||||
@ -128,7 +128,7 @@ NumberOfBillsByMonth=Nb of invoices by month
|
||||
ShowBill=Show invoice
|
||||
ShowInvoice=Show invoice
|
||||
ShowInvoiceReplace=Show replacing invoice
|
||||
ShowInvoiceAvoir=Show avoir invoice
|
||||
ShowInvoiceAvoir=Show credit note
|
||||
ShowPayment=Show payment
|
||||
File=File
|
||||
AlreadyPayed=Already payed
|
||||
|
||||
@ -22,6 +22,8 @@ NotAvailableWhenAjaxDisabled=Non disponible quand Ajax d
|
||||
JavascriptDisabled=Javascript désactivé
|
||||
UsePopupCalendar=Utiliser les popups pour la saisie des dates
|
||||
NextValue=Prochaine valeur
|
||||
NextValueForInvoices=Prochaine valeur (factures)
|
||||
NextValueForCreditNotes=Prochaine valeur (avoirs)
|
||||
MustBeLowerThanPHPLimit=Remarque: Votre PHP limite naturellement la taille à <b>%s</b> %s maximum, quelque soit la valeur de ce paramètre
|
||||
NoMaxSizeByPHPLimit=Aucune limite interne à votre serveur PHP
|
||||
ComptaSetup=Configuration du module Comptabilité
|
||||
|
||||
@ -315,7 +315,7 @@ OrionNumRefModelDesc3=D
|
||||
OrionNumRefModelDesc4=Dans cette exemple nous aurons au 1er septembre 2006 une facture nommée FA0700354.
|
||||
|
||||
# terre
|
||||
TerreNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0
|
||||
TerreNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn pour les factures et %syymm-nnnn pour les avoirs où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0
|
||||
TerreNumRefModelError=Une facture commençant par $fayymm existe en base et est incompatible avec cette numérotation. Supprimer la ou renommer la pour activer ce module.
|
||||
|
||||
# titan
|
||||
|
||||
@ -73,7 +73,8 @@ if (isset($dolibarr_auto_user)) $authmode=array('auto');
|
||||
$sessionname="DOLSESSID_".$dolibarr_main_db_name;
|
||||
session_name($sessionname);
|
||||
session_start();
|
||||
//dolibarr_syslog("We are in a session. Session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"]);
|
||||
dolibarr_syslog("Session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"]);
|
||||
dolibarr_syslog("Session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"]);
|
||||
|
||||
// Si la demande du login a déjà eu lieu, on le récupère depuis la session
|
||||
// sinon appel du module qui réalise sa demande.
|
||||
@ -83,7 +84,7 @@ if (! session_id() || ! isset($_SESSION["dol_login"]))
|
||||
{
|
||||
// On est pas déjà authentifié, on demande le login/mot de passe
|
||||
// A l'issu de cette demande, le login et un jeton doivent avoir été placé
|
||||
// en session dans dol_login et dol_token et la page rappelée.
|
||||
// en session dans dol_login et la page rappelée.
|
||||
|
||||
// MODE AUTO
|
||||
if (in_array('auto',$authmode) && ! $login)
|
||||
@ -221,7 +222,7 @@ if (! isset($_SESSION["dol_login"]))
|
||||
{
|
||||
// Nouvelle session pour ce login
|
||||
$_SESSION["dol_login"]=$user->login;
|
||||
dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]);
|
||||
dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());
|
||||
$user->update_last_login_date();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user