Fix: Maxi bug. Value for date used in object numbering module was current date instead of date of object.
This commit is contained in:
parent
2ec5ffee48
commit
6d8755edd4
@ -159,7 +159,7 @@ if ($_POST["action"] == 'set_use_customer_contact_as_recipient')
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -225,6 +225,7 @@ if ($handle)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$commande=new Commande($db);
|
$commande=new Commande($db);
|
||||||
|
$commande->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
|
|||||||
@ -281,6 +281,7 @@ while (($file = readdir($handle))!==false)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$facture=new Facture($db);
|
$facture=new Facture($db);
|
||||||
|
$facture->initAsSpecimen();
|
||||||
|
|
||||||
// Example for standard invoice
|
// Example for standard invoice
|
||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
|
|||||||
@ -226,12 +226,13 @@ if ($handle)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$livraison=new Livraison($db);
|
$livraison=new Livraison($db);
|
||||||
|
$livraison->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.='<b>'.$langs->trans("Version").'</b>: '.$module->getVersion().'<br>';
|
$htmltooltip.='<b>'.$langs->trans("Version").'</b>: '.$module->getVersion().'<br>';
|
||||||
$facture->type=0;
|
$facture->type=0;
|
||||||
$nextval=$module->getNextValue($mysoc,$propale);
|
$nextval=$module->getNextValue($mysoc,$livraison);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
||||||
{
|
{
|
||||||
$htmltooltip.='<b>'.$langs->trans("NextValue").'</b>: ';
|
$htmltooltip.='<b>'.$langs->trans("NextValue").'</b>: ';
|
||||||
|
|||||||
@ -195,7 +195,7 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
|||||||
print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup');
|
print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Module num<EFBFBD>rotation
|
* Module numerotation
|
||||||
*/
|
*/
|
||||||
print "<br>";
|
print "<br>";
|
||||||
print_titre($langs->trans("ProposalsNumberingModules"));
|
print_titre($langs->trans("ProposalsNumberingModules"));
|
||||||
@ -249,6 +249,7 @@ if ($handle)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$propale=new Propal($db);
|
$propale=new Propal($db);
|
||||||
|
$propale->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
|
|||||||
@ -404,7 +404,7 @@ if ($_POST['action'] == 'confirm_converttoreduc' && $_POST['confirm'] == 'yes' &
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insertion facture
|
* Insert invoice
|
||||||
*/
|
*/
|
||||||
if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -417,10 +417,22 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
// Facture remplacement
|
// Facture remplacement
|
||||||
if ($_POST['type'] == 1)
|
if ($_POST['type'] == 1)
|
||||||
{
|
{
|
||||||
if ($_POST['fac_replacement'] > 0)
|
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
|
if (empty($datefacture))
|
||||||
|
{
|
||||||
|
$error=1;
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $_POST['fac_replacement'] > 0)
|
||||||
|
{
|
||||||
|
$error=1;
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Si facture remplacement
|
// Si facture remplacement
|
||||||
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
|
||||||
|
|
||||||
$result=$facture->fetch($_POST['fac_replacement']);
|
$result=$facture->fetch($_POST['fac_replacement']);
|
||||||
|
|
||||||
@ -441,17 +453,25 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
$facid=$facture->create_clone($user);
|
$facid=$facture->create_clone($user);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$error=1;
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Facture avoir
|
// Facture avoir
|
||||||
if ($_POST['type'] == 2)
|
if ($_POST['type'] == 2)
|
||||||
{
|
{
|
||||||
if ($_POST['fac_avoir'] > 0)
|
if (! $_POST['fac_avoir'] > 0)
|
||||||
|
{
|
||||||
|
$error=1;
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
|
if (empty($datefacture))
|
||||||
|
{
|
||||||
|
$error=1;
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Si facture avoir
|
// Si facture avoir
|
||||||
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
@ -477,11 +497,6 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$error=1;
|
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0)
|
if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0)
|
||||||
@ -507,8 +522,16 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
if ($_POST['type'] == 0 && $_POST['fac_rec'] <= 0)
|
if ($_POST['type'] == 0 && $_POST['fac_rec'] <= 0)
|
||||||
{
|
{
|
||||||
// Si facture standard
|
|
||||||
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
|
if (empty($datefacture))
|
||||||
|
{
|
||||||
|
$error=1;
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// Si facture standard
|
||||||
|
|
||||||
$facture->socid = $_POST['socid'];
|
$facture->socid = $_POST['socid'];
|
||||||
$facture->type = $_POST['type'];
|
$facture->type = $_POST['type'];
|
||||||
@ -707,7 +730,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fin création facture, on l'affiche
|
// Fin création facture, on l'affiche
|
||||||
@ -1184,6 +1207,10 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans('Bill'),'HelpInvoice');
|
llxHeader('',$langs->trans('Bill'),'HelpInvoice');
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
@ -1257,7 +1284,7 @@ if ($_GET['action'] == 'create')
|
|||||||
$mode_reglement_id = $soc->mode_reglement;
|
$mode_reglement_id = $soc->mode_reglement;
|
||||||
$remise_percent = $soc->remise_client;
|
$remise_percent = $soc->remise_client;
|
||||||
$remise_absolue = 0;
|
$remise_absolue = 0;
|
||||||
$dateinvoice=mktime();
|
$dateinvoice=-1;
|
||||||
}
|
}
|
||||||
$absolute_discount=$soc->getAvailableDiscounts();
|
$absolute_discount=$soc->getAvailableDiscounts();
|
||||||
|
|
||||||
@ -1320,6 +1347,7 @@ if ($_GET['action'] == 'create')
|
|||||||
print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="2">';
|
print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||||
print '<table class="nobordernopadding">'."\n";
|
print '<table class="nobordernopadding">'."\n";
|
||||||
|
|
||||||
|
// Type
|
||||||
print '<tr><td width="16px" valign="middle">';
|
print '<tr><td width="16px" valign="middle">';
|
||||||
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>';
|
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>';
|
||||||
print '</td><td valign="middle">';
|
print '</td><td valign="middle">';
|
||||||
@ -1378,7 +1406,7 @@ if ($_GET['action'] == 'create')
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Ligne info remises tiers
|
// Discounts for third party
|
||||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
|
||||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||||
@ -1388,7 +1416,7 @@ if ($_GET['action'] == 'create')
|
|||||||
print '.';
|
print '.';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date facture
|
// Date invoice
|
||||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="2">';
|
||||||
$html->select_date($dateinvoice,'','','','',"add");
|
$html->select_date($dateinvoice,'','','','',"add");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -57,7 +57,10 @@ class Facture extends CommonObject
|
|||||||
var $client;
|
var $client;
|
||||||
var $number;
|
var $number;
|
||||||
var $author;
|
var $author;
|
||||||
|
//! Invoice date
|
||||||
var $date;
|
var $date;
|
||||||
|
var $date_creation;
|
||||||
|
var $date_validation;
|
||||||
var $ref;
|
var $ref;
|
||||||
var $ref_client;
|
var $ref_client;
|
||||||
//! 0=Facture normale, 1=Facture remplacement, 2=Facture avoir, 3=Facture récurrente
|
//! 0=Facture normale, 1=Facture remplacement, 2=Facture avoir, 3=Facture récurrente
|
||||||
@ -423,11 +426,13 @@ class Facture extends CommonObject
|
|||||||
dolibarr_syslog("Facture::Fetch rowid=".$rowid.", societe_id=".$societe_id, LOG_DEBUG);
|
dolibarr_syslog("Facture::Fetch rowid=".$rowid.", societe_id=".$societe_id, LOG_DEBUG);
|
||||||
|
|
||||||
$sql = 'SELECT f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
|
$sql = 'SELECT f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
|
||||||
$sql.= ','.$this->db->pdate('f.datef').' as df, f.fk_projet';
|
$sql.= ','.$this->db->pdate('f.datef').' as df';
|
||||||
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
|
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
|
||||||
|
$sql.= ','.$this->db->pdate('f.datec').' as datec';
|
||||||
|
$sql.= ','.$this->db->pdate('f.date_valid').' as datev';
|
||||||
$sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.model_pdf';
|
$sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.model_pdf';
|
||||||
$sql.= ', f.fk_facture_source';
|
$sql.= ', f.fk_facture_source';
|
||||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement';
|
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_facture';
|
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_facture';
|
||||||
$sql.= ', cf.fk_commande';
|
$sql.= ', cf.fk_commande';
|
||||||
@ -453,6 +458,8 @@ class Facture extends CommonObject
|
|||||||
$this->ref_client = $obj->ref_client;
|
$this->ref_client = $obj->ref_client;
|
||||||
$this->type = $obj->type;
|
$this->type = $obj->type;
|
||||||
$this->date = $obj->df;
|
$this->date = $obj->df;
|
||||||
|
$this->date_creation = $obj->datec;
|
||||||
|
$this->date_validation = $obj->datev;
|
||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->remise_percent = $obj->remise_percent;
|
$this->remise_percent = $obj->remise_percent;
|
||||||
$this->remise_absolue = $obj->remise_absolue;
|
$this->remise_absolue = $obj->remise_absolue;
|
||||||
@ -997,7 +1004,7 @@ class Facture extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Tag la facture comme validée + appel trigger BILL_VALIDATE
|
* \brief Tag la facture comme validée + appel trigger BILL_VALIDATE
|
||||||
* \param user Utilisateur qui valide la facture
|
* \param user Utilisateur qui valide la facture
|
||||||
* \param soc Ne sert plus \\TODO A virer
|
* \param soc Ne sert plus. \\TODO A virer
|
||||||
* \param force_number Référence à forcer de la facture
|
* \param force_number Référence à forcer de la facture
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'commande_fournisseur','ref','',$objsoc->code_client);
|
$numFinal=get_next_value($db,$mask,'commande_fournisseur','ref','',$objsoc->code_client,$commande->date_commande);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
|
|||||||
* \param commande Object order
|
* \param commande Object order
|
||||||
* \return string Value if OK, 0 if KO
|
* \return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc=0,$commande)
|
function getNextValue($objsoc,$commande)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -129,22 +129,25 @@ class mod_commande_marbre extends ModeleNumRefCommandes
|
|||||||
{
|
{
|
||||||
$max=0;
|
$max=0;
|
||||||
}
|
}
|
||||||
$yymm = strftime("%y%m",time());
|
//$date=time();
|
||||||
|
$date=$commande->date;
|
||||||
|
$yymm = strftime("%y%m",$date);
|
||||||
$num = sprintf("%04s",$max+1);
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
dolibarr_syslog("mod_commande_marbre::getNextValue return ".$this->prefix."$yymm-$num");
|
dolibarr_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||||
return $this->prefix."$yymm-$num";
|
return $this->prefix.$yymm."-".$num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Renvoie la référence de commande suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \return string Texte descripif
|
* \param objforref Object for number to search
|
||||||
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function commande_get_num($objsoc=0)
|
function commande_get_num($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc);
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -64,10 +64,12 @@ class mod_commande_opale extends ModeleNumRefCommandes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Renvoi prochaine valeur attribuée
|
/** \brief Return next value
|
||||||
* \return string Valeur
|
* \param objsoc Objet third party
|
||||||
|
* \param commande Object order
|
||||||
|
* \return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function getNextValue()
|
function getNextValue($objsoc,$commande)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -90,20 +92,24 @@ class mod_commande_opale extends ModeleNumRefCommandes
|
|||||||
{
|
{
|
||||||
$max=0;
|
$max=0;
|
||||||
}
|
}
|
||||||
$yy = strftime("%y",time());
|
//$date=time();
|
||||||
|
$date=$commande->date;
|
||||||
|
$yy = strftime("%y",$date);
|
||||||
$hex = strtoupper(dechex($max+1));
|
$hex = strtoupper(dechex($max+1));
|
||||||
$ref = substr("000000".($hex),-6);
|
$ref = substr("000000".($hex),-6);
|
||||||
|
|
||||||
return 'COM-'.substr($ref,0,3)."-".substr($ref,3,3);
|
return 'COM-'.substr($ref,0,3)."-".substr($ref,3,3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoie la référence de commande suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \return string Texte descripif
|
* \param objforref Object for number to search
|
||||||
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function commande_get_num($objsoc=0)
|
function commande_get_num($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue();
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
|||||||
* \param commande Object order
|
* \param commande Object order
|
||||||
* \return string Value if OK, 0 if KO
|
* \return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc=0,$commande)
|
function getNextValue($objsoc,$commande)
|
||||||
{
|
{
|
||||||
global $db,$conf;
|
global $db,$conf;
|
||||||
|
|
||||||
@ -111,20 +111,20 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc->code_client);
|
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc->code_client,$commande->date);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Renvoie la référence de commande suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \param commande Objet commande
|
* \param objforref Object for number to search
|
||||||
* \return string Texte descripif
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function commande_get_num($objsoc=0,$commande)
|
function commande_get_num($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc,$commande);
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,20 +121,20 @@ class mod_facture_mercure extends ModeleNumRefFactures
|
|||||||
if ($facture->type == 2) $where.= " AND type = 2";
|
if ($facture->type == 2) $where.= " AND type = 2";
|
||||||
else $where.=" AND type != 2";
|
else $where.=" AND type != 2";
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc->code_client);
|
$numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc->code_client,$facture->date);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Renvoie la reference de commande suivante non utilisee
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet societe
|
* \param objsoc Object third party
|
||||||
* \param facture Objet facture
|
* \param objforref Object for number to search
|
||||||
* \return string Texte descripif
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc=0,$facture)
|
function getNumRef($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc,$facture);
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -16,16 +16,13 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/modules/facture/terre/terre.modules.php
|
\file htdocs/includes/modules/facture/terre/terre.modules.php
|
||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Fichier contenant la classe du modèle de numérotation de référence de facture Terre
|
\brief Fichier contenant la classe du modèle de numérotation de référence de facture Terre
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||||
@ -145,9 +142,9 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
{
|
{
|
||||||
// Recherche rapide car restreint par un like sur champ indexé
|
// Recherche rapide car restreint par un like sur champ indexé
|
||||||
$posindice=8;
|
$posindice=8;
|
||||||
$sql = "SELECT MAX(0+SUBSTRING(facnumber,$posindice))";
|
$sql = "SELECT MAX(0+SUBSTRING(facnumber,".$posindice."))";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber like '${fayymm}%'";
|
$sql.= " WHERE facnumber like '".$fayymm."%'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -159,21 +156,24 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
{
|
{
|
||||||
$max=0;
|
$max=0;
|
||||||
}
|
}
|
||||||
$yymm = strftime("%y%m",time());
|
|
||||||
|
//$date=time();
|
||||||
|
$date=$facture->date;
|
||||||
|
$yymm = strftime("%y%m",$date);
|
||||||
$num = sprintf("%04s",$max+1);
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
dolibarr_syslog("mod_facture_terre::getNextValue return ".$prefix."$yymm-$num");
|
dolibarr_syslog("mod_facture_terre::getNextValue return ".$prefix.$yymm."-".$num);
|
||||||
return $prefix."$yymm-$num";
|
return $prefix.$yymm."-".$num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoie la référence de facture suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \param facture Objet facture
|
* \param objforref Object for number to search
|
||||||
* \return string Texte descripif
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc=0,$facture)
|
function getNumRef($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc,$facture);
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,20 +116,20 @@ class mod_arctic extends ModeleNumRefFicheinter
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc->code_client);
|
$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc->code_client,$ficheinter->date);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Renvoie la référence de fichinter suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \param fichinter Objet fichinter
|
* \param objforref Object for number to search
|
||||||
* \return string Texte descripif
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc=0,$ficheinter='')
|
function getNumRef($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc,$ficheinter);
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,16 +16,13 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/modules/fichinter/mod_pacific.php
|
\file htdocs/includes/modules/fichinter/mod_pacific.php
|
||||||
\ingroup fiche intervention
|
\ingroup fiche intervention
|
||||||
\brief Fichier contenant la classe du modèle de numérotation de référence de fiche intervention Pacific
|
\brief Fichier contenant la classe du modèle de numérotation de référence de fiche intervention Pacific
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/modules_fichinter.php");
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/modules_fichinter.php");
|
||||||
@ -101,9 +98,11 @@ class mod_pacific extends ModeleNumRefFicheinter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoi prochaine valeur attribuée
|
/** \brief Renvoi prochaine valeur attribuée
|
||||||
|
* \param objsoc Objet société
|
||||||
|
* \param ficheinter Object ficheinter
|
||||||
* \return string Valeur
|
* \return string Valeur
|
||||||
*/
|
*/
|
||||||
function getNextValue()
|
function getNextValue($objsoc=0,$ficheinter='')
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -123,9 +122,9 @@ class mod_pacific extends ModeleNumRefFicheinter
|
|||||||
{
|
{
|
||||||
// Recherche rapide car restreint par un like sur champ indexé
|
// Recherche rapide car restreint par un like sur champ indexé
|
||||||
$posindice=8;
|
$posindice=8;
|
||||||
$sql = "SELECT MAX(0+SUBSTRING(ref,$posindice))";
|
$sql = "SELECT MAX(0+SUBSTRING(ref,".$posindice."))";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
|
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
|
||||||
$sql.= " WHERE ref like '${fayymm}%'";
|
$sql.= " WHERE ref like '".$fayymm."%'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -137,19 +136,21 @@ class mod_pacific extends ModeleNumRefFicheinter
|
|||||||
{
|
{
|
||||||
$max=0;
|
$max=0;
|
||||||
}
|
}
|
||||||
$yymm = strftime("%y%m",time());
|
//$yymm = strftime("%y%m",time());
|
||||||
|
$yymm = strftime("%y%m",$ficheinter->date);
|
||||||
$num = sprintf("%04s",$max+1);
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
return $this->prefix."$yymm-$num";
|
return $this->prefix.$yymm."-".$num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoie la référence de fiche d'intervention suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \return string Texte descripif
|
* \param objforref Object for number to search
|
||||||
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc=0)
|
function getNumRef($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue();
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -85,11 +85,12 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoi prochaine valeur attribuée
|
/** \brief Return next value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
|
* \param propal Object commercial proposal
|
||||||
* \return string Valeur
|
* \return string Valeur
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc=0)
|
function getNextValue($objsoc,$propal)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -114,9 +115,9 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
{
|
{
|
||||||
// Recherche rapide car restreint par un like sur champ indexé
|
// Recherche rapide car restreint par un like sur champ indexé
|
||||||
$posindice=8;
|
$posindice=8;
|
||||||
$sql = "SELECT MAX(0+SUBSTRING(ref,$posindice))";
|
$sql = "SELECT MAX(0+SUBSTRING(ref,".$posindice."))";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propal";
|
||||||
$sql.= " WHERE ref like '${pryymm}%'";
|
$sql.= " WHERE ref like '".$pryymm."%'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -128,20 +129,22 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
{
|
{
|
||||||
$max=0;
|
$max=0;
|
||||||
}
|
}
|
||||||
$yymm = strftime("%y%m",time());
|
//$yymm = strftime("%y%m",time());
|
||||||
|
$yymm = strftime("%y%m",$propal->date);
|
||||||
$num = sprintf("%04s",$max+1);
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
dolibarr_syslog("mod_propale_marbre::getNextValue return ".$this->prefix."$yymm-$num");
|
dolibarr_syslog("mod_propale_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||||
return $this->prefix."$yymm-$num";
|
return $this->prefix.$yymm."-".$num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoie la référence de propale suivante non utilisée
|
/** \brief Return next free value
|
||||||
* \param objsoc Objet société
|
* \param objsoc Object third party
|
||||||
* \return string Texte descripif
|
* \param objforref Object for number to search
|
||||||
|
* \return string Next free value
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc=0)
|
function getNumRef($objsoc,$objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue();
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
|
|||||||
* \param propal Object commercial proposal
|
* \param propal Object commercial proposal
|
||||||
* \return string Value if OK, 0 if KO
|
* \return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc,$propal='')
|
function getNextValue($objsoc,$propal)
|
||||||
{
|
{
|
||||||
global $db,$conf;
|
global $db,$conf;
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'propal','ref','',$objsoc->code_client);
|
$numFinal=get_next_value($db,$mask,'propal','ref','',$objsoc->code_client,$propal->date);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,10 +32,16 @@
|
|||||||
* @param $mask
|
* @param $mask
|
||||||
* @param unknown_type $table
|
* @param unknown_type $table
|
||||||
* @param unknown_type $field
|
* @param unknown_type $field
|
||||||
|
* @param unknown_type $where
|
||||||
|
* @param unknown_type $valueforccc
|
||||||
|
* @param unknown_type $date
|
||||||
* @return string New value
|
* @return string New value
|
||||||
*/
|
*/
|
||||||
function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='')
|
function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date='')
|
||||||
{
|
{
|
||||||
|
// Clean parameters
|
||||||
|
if ($date == '') $date=time();
|
||||||
|
|
||||||
// Extract value for mask counter, mask raz and mask offset
|
// Extract value for mask counter, mask raz and mask offset
|
||||||
if (! eregi('\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}',$mask,$reg)) return 'ErrorBadMask';
|
if (! eregi('\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}',$mask,$reg)) return 'ErrorBadMask';
|
||||||
$masktri=$reg[1].$reg[2].$reg[3];
|
$masktri=$reg[1].$reg[2].$reg[3];
|
||||||
@ -92,10 +98,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='')
|
|||||||
$monthcomp=$maskraz;
|
$monthcomp=$maskraz;
|
||||||
$yearoffset=0;
|
$yearoffset=0;
|
||||||
$yearcomp=0;
|
$yearcomp=0;
|
||||||
if (date("m") < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
|
if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
|
||||||
if (strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y")+$yearoffset);
|
if (strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
|
||||||
if (strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y")+$yearoffset);
|
if (strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
|
||||||
if (strlen($reg[2]) == 1) $yearcomp=substr(date("y"),2,1)+$yearoffset;
|
if (strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
|
||||||
|
|
||||||
$sqlwhere='';
|
$sqlwhere='';
|
||||||
$sqlwhere.='SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.$yearcomp;
|
$sqlwhere.='SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.$yearcomp;
|
||||||
@ -191,11 +197,11 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='')
|
|||||||
$numFinal = $mask;
|
$numFinal = $mask;
|
||||||
|
|
||||||
// We replace special codes except refclient
|
// We replace special codes except refclient
|
||||||
$numFinal = str_replace('{yyyy}',date("Y"),$numFinal);
|
$numFinal = str_replace('{yyyy}',date("Y",$date),$numFinal);
|
||||||
$numFinal = str_replace('{yy}',date("y"),$numFinal);
|
$numFinal = str_replace('{yy}',date("y",$date),$numFinal);
|
||||||
$numFinal = str_replace('{y}' ,substr(date("y"),2,1),$numFinal);
|
$numFinal = str_replace('{y}' ,substr(date("y",$date),2,1),$numFinal);
|
||||||
$numFinal = str_replace('{mm}',date("m"),$numFinal);
|
$numFinal = str_replace('{mm}',date("m",$date),$numFinal);
|
||||||
$numFinal = str_replace('{dd}',date("d"),$numFinal);
|
$numFinal = str_replace('{dd}',date("d",$date),$numFinal);
|
||||||
if ($maskclientcode) $numFinal = str_replace(('{'.$maskclientcode.'}'),$clientcode,$numFinal);
|
if ($maskclientcode) $numFinal = str_replace(('{'.$maskclientcode.'}'),$clientcode,$numFinal);
|
||||||
|
|
||||||
// Now we replace the counter
|
// Now we replace the counter
|
||||||
|
|||||||
@ -15,16 +15,13 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/lib/propal.lib.php
|
\file htdocs/lib/propal.lib.php
|
||||||
\brief Ensemble de fonctions de base pour le module propal
|
\brief Ensemble de fonctions de base pour le module propal
|
||||||
\ingroup propal
|
\ingroup propal
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
|
|
||||||
Ensemble de fonctions de base de dolibarr sous forme d'include
|
Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -47,6 +47,11 @@ class Livraison extends CommonObject
|
|||||||
var $origin_id;
|
var $origin_id;
|
||||||
var $socid;
|
var $socid;
|
||||||
|
|
||||||
|
var $date_livraison;
|
||||||
|
var $date_creation;
|
||||||
|
var $date_valid;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisation
|
* Initialisation
|
||||||
*
|
*
|
||||||
@ -241,6 +246,7 @@ class Livraison extends CommonObject
|
|||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
$this->date_livraison = $obj->date_livraison;
|
||||||
$this->date_creation = $obj->date_creation;
|
$this->date_creation = $obj->date_creation;
|
||||||
$this->date_valid = $obj->date_valid;
|
$this->date_valid = $obj->date_valid;
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
@ -251,7 +257,6 @@ class Livraison extends CommonObject
|
|||||||
$this->expedition_id = $obj->fk_expedition;
|
$this->expedition_id = $obj->fk_expedition;
|
||||||
$this->user_author_id = $obj->fk_user_author;
|
$this->user_author_id = $obj->fk_user_author;
|
||||||
$this->user_valid_id = $obj->fk_user_valid;
|
$this->user_valid_id = $obj->fk_user_valid;
|
||||||
$this->date_livraison = $obj->date_livraison;
|
|
||||||
$this->adresse_livraison_id = $obj->fk_adresse_livraison;
|
$this->adresse_livraison_id = $obj->fk_adresse_livraison;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
@ -696,6 +701,57 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialise object with default value to be used as example
|
||||||
|
*/
|
||||||
|
function initAsSpecimen()
|
||||||
|
{
|
||||||
|
global $user,$langs;
|
||||||
|
|
||||||
|
// Charge tableau des id de soci<63>t<EFBFBD> socids
|
||||||
|
$socids = array();
|
||||||
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client=1 LIMIT 10";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num_socs = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num_socs)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
$socids[$i] = $row[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Charge tableau des produits prodids
|
||||||
|
$prodids = array();
|
||||||
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE envente=1";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num_prods = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num_prods)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
$prodids[$i] = $row[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialise parametres
|
||||||
|
$this->id=0;
|
||||||
|
$this->ref = 'SPECIMEN';
|
||||||
|
$this->specimen=1;
|
||||||
|
$socid = rand(1, $num_socs);
|
||||||
|
$this->socid = $socids[$socid];
|
||||||
|
$this->date_livraison = time();
|
||||||
|
$this->note_public='SPECIMEN';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,10 +57,12 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
|
|||||||
return "BL0600001";
|
return "BL0600001";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Renvoi prochaine valeur attribuée
|
/** \brief Return next value
|
||||||
* \return string Valeur
|
* \param objsoc Object third party
|
||||||
|
* \param livraison Object delivery
|
||||||
|
* \return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function getNextValue()
|
function getNextValue($objsoc=0,$livraison='')
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
|
|||||||
$posindice=5;
|
$posindice=5;
|
||||||
$sql = "SELECT MAX(0+SUBSTRING(ref,$posindice))";
|
$sql = "SELECT MAX(0+SUBSTRING(ref,$posindice))";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."livraison";
|
$sql.= " FROM ".MAIN_DB_PREFIX."livraison";
|
||||||
$sql.= " WHERE ref like '${blyy}%'";
|
$sql.= " WHERE ref like '".$blyy."%'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -94,7 +96,9 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
|
|||||||
{
|
{
|
||||||
$max=0;
|
$max=0;
|
||||||
}
|
}
|
||||||
$yy = strftime("%y",time());
|
//$date=time();
|
||||||
|
$date=$livraison->date_livraison;
|
||||||
|
$yy = strftime("%y",$date);
|
||||||
$num = sprintf("%05s",$max+1);
|
$num = sprintf("%05s",$max+1);
|
||||||
|
|
||||||
return "BL$yy$num";
|
return "BL$yy$num";
|
||||||
@ -103,11 +107,12 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
|
|||||||
|
|
||||||
/** \brief Renvoie la référence de commande suivante non utilisée
|
/** \brief Renvoie la référence de commande suivante non utilisée
|
||||||
* \param objsoc Objet société
|
* \param objsoc Objet société
|
||||||
|
* \param livraison Objet livraison
|
||||||
* \return string Texte descripif
|
* \return string Texte descripif
|
||||||
*/
|
*/
|
||||||
function livraison_get_num($objsoc=0)
|
function livraison_get_num($objsoc=0,$livraison='')
|
||||||
{
|
{
|
||||||
return $this->getNextValue();
|
return $this->getNextValue($objsoc,$livraison);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -92,7 +92,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
|
|||||||
|
|
||||||
/** \brief Return next value
|
/** \brief Return next value
|
||||||
* \param objsoc Object third party
|
* \param objsoc Object third party
|
||||||
* \param livraison Object proposal
|
* \param livraison Object delivery
|
||||||
* \return string Value if OK, 0 if KO
|
* \return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc=0,$livraison='')
|
function getNextValue($objsoc=0,$livraison='')
|
||||||
@ -110,15 +110,26 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc->code_client);
|
$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc->code_client,$livraison->date_livraison);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Return next free value
|
||||||
|
* \param objsoc Object third party
|
||||||
|
* \param objforref Object for number to search
|
||||||
|
* \return string Next free value
|
||||||
|
*/
|
||||||
|
function getNumRef($objsoc,$objforref)
|
||||||
|
{
|
||||||
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Renvoie la référence de commande suivante non utilisée
|
/** \brief Renvoie la référence de commande suivante non utilisée
|
||||||
* \param objsoc Objet société
|
* \param objsoc Objet société
|
||||||
* \param commande Objet commande
|
* \param livraison Objet livraison
|
||||||
* \return string Texte descripif
|
* \return string Texte descripif
|
||||||
*/
|
*/
|
||||||
function livraison_get_num($objsoc=0,$livraison='')
|
function livraison_get_num($objsoc=0,$livraison='')
|
||||||
|
|||||||
@ -61,7 +61,10 @@ class Propal extends CommonObject
|
|||||||
var $ref;
|
var $ref;
|
||||||
var $ref_client;
|
var $ref_client;
|
||||||
var $statut; // 0, 1, 2, 3, 4
|
var $statut; // 0, 1, 2, 3, 4
|
||||||
var $datep;
|
var $date; // Date of proposal
|
||||||
|
var $datep; // Duplicate with date
|
||||||
|
var $date_livraison;
|
||||||
|
|
||||||
var $fin_validite;
|
var $fin_validite;
|
||||||
var $price; // Total HT
|
var $price; // Total HT
|
||||||
var $tva; // Total TVA
|
var $tva; // Total TVA
|
||||||
@ -75,7 +78,6 @@ class Propal extends CommonObject
|
|||||||
var $remise_absolue;
|
var $remise_absolue;
|
||||||
var $note;
|
var $note;
|
||||||
var $note_public;
|
var $note_public;
|
||||||
var $date_livraison;
|
|
||||||
var $adresse_livraison_id;
|
var $adresse_livraison_id;
|
||||||
var $adresse;
|
var $adresse;
|
||||||
|
|
||||||
@ -685,9 +687,9 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
$this->id = $rowid;
|
$this->id = $rowid;
|
||||||
|
|
||||||
|
$this->date = $obj->dp;
|
||||||
$this->datep = $obj->dp;
|
$this->datep = $obj->dp;
|
||||||
$this->fin_validite = $obj->dfv;
|
$this->fin_validite = $obj->dfv;
|
||||||
$this->date = $obj->dp;
|
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
$this->ref_client = $obj->ref_client;
|
$this->ref_client = $obj->ref_client;
|
||||||
$this->remise = $obj->remise;
|
$this->remise = $obj->remise;
|
||||||
@ -1693,8 +1695,7 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Initialise la propale avec valeurs fictives al<EFBFBD>atoire
|
* \brief Initialise object with default value to be used as example
|
||||||
* Sert <EFBFBD> g<EFBFBD>n<EFBFBD>rer une facture pour l'aperu des mod<EFBFBD>les ou demo
|
|
||||||
*/
|
*/
|
||||||
function initAsSpecimen()
|
function initAsSpecimen()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user