New: Customer and supplier codes can be automatically generated

This commit is contained in:
Laurent Destailleur
2009-01-31 15:23:05 +00:00
parent 67c92017c2
commit bb90ab1288
49 changed files with 907 additions and 1219 deletions

View File

@@ -40,7 +40,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
var $error = '';
var $nom = 'Saphir';
/** \brief Renvoi la description du modele de num<75>rotation
* \return string Texte descripif
*/
@@ -49,23 +49,29 @@ class mod_commande_saphir extends ModeleNumRefCommandes
global $conf,$langs;
$langs->load("bills");
$form = new Form($db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="action" value="updateMask">';
$texte.= '<input type="hidden" name="maskconstorder" value="COMMANDE_SAPHIR_MASK">';
$texte.= '<table class="nobordernopadding" width="100%">';
// Parametrage du prefix des factures
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"));
$tooltip.=$langs->trans("GenericMaskCodes2");
$tooltip.=$langs->trans("GenericMaskCodes3");
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
$tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte.= '<td align="right">'.$form->textwithhelp('<input type="text" class="flat" size="24" name="maskorder" value="'.$conf->global->COMMANDE_SAPHIR_MASK.'">',$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"),$langs->transnoentities("Order")),1,1).'</td>';
$texte.= '<td align="right">'.$form->textwithhelp('<input type="text" class="flat" size="24" name="maskorder" value="'.$conf->global->COMMANDE_SAPHIR_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '</form>';
@@ -78,12 +84,12 @@ class mod_commande_saphir extends ModeleNumRefCommandes
function getExample()
{
global $conf,$langs,$mysoc;
$old_code_client=$mysoc->code_client;
$mysoc->code_client='CCCCCCCCCC';
$numExample = $this->getNextValue($mysoc,'');
$mysoc->code_client=$old_code_client;
if (! $numExample)
{
$numExample = $langs->trans('NotConfigured');
@@ -101,22 +107,22 @@ class mod_commande_saphir extends ModeleNumRefCommandes
global $db,$conf;
require_once(DOL_DOCUMENT_ROOT ."/lib/functions2.lib.php");
// We get cursor rule
$mask=$conf->global->COMMANDE_SAPHIR_MASK;
if (! $mask)
if (! $mask)
{
$this->error='NotConfigured';
return 0;
}
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc->code_client,$commande->date);
return $numFinal;
}
/** \brief Return next free value
* \param objsoc Object third party
* \param objforref Object for number to search
@@ -126,7 +132,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
{
return $this->getNextValue($objsoc,$objforref);
}
}
}
?>