Missing translation
This commit is contained in:
parent
d298438e66
commit
23c118a40c
@ -23,11 +23,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/commande.php
|
||||
\ingroup commande
|
||||
\brief Page d'administration-configuration du module Commande
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/admin/commande.php
|
||||
\ingroup commande
|
||||
\brief Page d'administration-configuration du module Commande
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
@ -39,12 +39,12 @@ $langs->load("other");
|
||||
$langs->load("orders");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($_POST["action"] == 'updateMask')
|
||||
{
|
||||
$maskconstorder=$_POST['maskconstorder'];
|
||||
@ -54,92 +54,92 @@ if ($_POST["action"] == 'updateMask')
|
||||
|
||||
if ($_GET["action"] == 'specimen')
|
||||
{
|
||||
$modele=$_GET["module"];
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/commande/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($commande) > 0)
|
||||
$modele=$_GET["module"];
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/commande/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
|
||||
return;
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($commande) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
$type='order';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
$type='order';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'del')
|
||||
{
|
||||
$type='order';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
$type='order';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'setdoc')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"]))
|
||||
{
|
||||
$conf->global->COMMANDE_ADDON_PDF = $_GET["value"];
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$type='order';
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
$result1=$db->query($sql_del);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
$result2=$db->query($sql);
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
$db->begin();
|
||||
|
||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"]))
|
||||
{
|
||||
$conf->global->COMMANDE_ADDON_PDF = $_GET["value"];
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$type='order';
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
$result1=$db->query($sql_del);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
$result2=$db->query($sql);
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'setmod')
|
||||
{
|
||||
// \todo Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]);
|
||||
// \todo Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'set_COMMANDE_DRAFT_WATERMARK')
|
||||
{
|
||||
dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($_POST["COMMANDE_DRAFT_WATERMARK"]));
|
||||
dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($_POST["COMMANDE_DRAFT_WATERMARK"]));
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'set_COMMANDE_FREE_TEXT')
|
||||
{
|
||||
dolibarr_set_const($db, "COMMANDE_FREE_TEXT",trim($_POST["COMMANDE_FREE_TEXT"]));
|
||||
dolibarr_set_const($db, "COMMANDE_FREE_TEXT",trim($_POST["COMMANDE_FREE_TEXT"]));
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'setvalidorder')
|
||||
@ -172,6 +172,12 @@ print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup');
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("OrdersNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -189,55 +195,55 @@ $dir = "../includes/modules/commande/";
|
||||
$handle = opendir($dir);
|
||||
if ($handle)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
$var=true;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
|
||||
$module = new $file;
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
|
||||
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Examples
|
||||
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->COMMANDE_ADDON == "$file")
|
||||
{
|
||||
print img_tick($langs->trans("Activated"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$commande=new Commande($db);
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Examples
|
||||
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->COMMANDE_ADDON == "$file")
|
||||
{
|
||||
print img_tick($langs->trans("Activated"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$commande=new Commande($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.='<b>'.$langs->trans("Version").'</b>: '.$module->getVersion().'<br>';
|
||||
$facture->type=0;
|
||||
$nextval=$module->getNextValue($mysoc,$commande);
|
||||
$nextval=$module->getNextValue($mysoc,$commande);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
||||
{
|
||||
$htmltooltip.='<b>'.$langs->trans("NextValue").'</b>: ';
|
||||
if ($nextval)
|
||||
if ($nextval)
|
||||
{
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
}
|
||||
@ -246,20 +252,21 @@ if ($handle)
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Modeles de documents
|
||||
*/
|
||||
@ -319,12 +326,12 @@ while (($file = readdir($handle))!==false)
|
||||
$module = new $classname($db);
|
||||
print $module->description;
|
||||
print "</td>\n";
|
||||
|
||||
// Activ<EFBFBD>
|
||||
|
||||
// Activated
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
if ($conf->global->COMMANDE_ADDON_PDF != "$name")
|
||||
if ($conf->global->COMMANDE_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_tick($langs->trans("Disable"));
|
||||
@ -354,27 +361,27 @@ while (($file = readdir($handle))!==false)
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Info
|
||||
$htmltooltip = '<b>'.$langs->trans("Name").'</b>: '.$module->name;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'/'.$langs->trans("Width").'</b>: '.$module->page_hauteur.'/'.$module->page_largeur;
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
|
||||
// \TODO : $htmltooltip.='<br><b>'.$langs->trans("Escompte").'</b>: '.yn($module->option_escompte);
|
||||
$htmltooltip = '<b>'.$langs->trans("Name").'</b>: '.$module->name;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'/'.$langs->trans("Width").'</b>: '.$module->page_hauteur.'/'.$module->page_largeur;
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
|
||||
// \TODO : $htmltooltip.='<br><b>'.$langs->trans("Escompte").'</b>: '.yn($module->option_escompte);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("CreditNote").'</b>: '.yn($module->option_credit_note);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("FreeLegalTextOnOrders").'</b>: '.yn($module->option_freetext);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("WatermarkOnDraftOrders").'</b>: '.yn($module->option_draft_watermark);
|
||||
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
// Now load lines
|
||||
$this->lignes = array();
|
||||
|
||||
|
||||
$sql = "SELECT l.rowid, l.ref as ref_fourn, l.fk_product, l.label, l.description, l.qty,";
|
||||
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
|
||||
$sql.= " l.total_ht, l.total_tva, l.total_ttc,";
|
||||
@ -130,7 +130,7 @@ class CommandeFournisseur extends Commande
|
||||
$sql.= " WHERE l.fk_commande = ".$this->id;
|
||||
$sql.= " ORDER BY l.rowid";
|
||||
//print $sql;
|
||||
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::fetch sql=".$sql,LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -160,7 +160,7 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
$ligne->ref = $objp->ref; // Reference
|
||||
$ligne->ref_fourn = $objp->ref_fourn; // Reference supplier
|
||||
|
||||
|
||||
$this->lignes[$i] = $ligne;
|
||||
//dolibarr_syslog("1 ".$ligne->desc);
|
||||
//dolibarr_syslog("2 ".$ligne->product_desc);
|
||||
@ -216,7 +216,7 @@ class CommandeFournisseur extends Commande
|
||||
global $langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::Valid");
|
||||
$result = 0;
|
||||
if ($user->rights->fournisseur->commande->valider)
|
||||
@ -248,23 +248,8 @@ class CommandeFournisseur extends Commande
|
||||
$this->log($user, 1, time()); // Statut 1
|
||||
$this->ref = $num;
|
||||
|
||||
// If stock is incremented on validate order, we must increment it
|
||||
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrement stock of product (and sub-products)
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
@ -272,7 +257,7 @@ class CommandeFournisseur extends Commande
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -304,7 +289,7 @@ class CommandeFournisseur extends Commande
|
||||
/**
|
||||
* \brief Annule la commande
|
||||
* \param user Utilisateur qui demande annulation
|
||||
* \remarks L'annulation se fait apr<EFBFBD>s la validation
|
||||
* \remarks L'annulation se fait apres la validation
|
||||
*/
|
||||
function Cancel($user)
|
||||
{
|
||||
@ -316,28 +301,42 @@ class CommandeFournisseur extends Commande
|
||||
{
|
||||
$statut = 6;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut;
|
||||
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1 ;";
|
||||
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$result = 0;
|
||||
$this->log($user, $statut, time());
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$result = 0;
|
||||
$this->log($user, $statut, time());
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::Cancel Error -1");
|
||||
return -1;
|
||||
}
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::Cancel Error -1");
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -461,32 +460,32 @@ class CommandeFournisseur extends Commande
|
||||
$file = COMMANDE_SUPPLIER_ADDON.'.php';
|
||||
|
||||
if (is_readable($dir.'/'.$file))
|
||||
{
|
||||
// Definition du nom de module de numerotation de commande fournisseur
|
||||
$modName=$conf->global->COMMANDE_SUPPLIER_ADDON;
|
||||
require_once($dir.'/'.$file);
|
||||
{
|
||||
// Definition du nom de module de numerotation de commande fournisseur
|
||||
$modName=$conf->global->COMMANDE_SUPPLIER_ADDON;
|
||||
require_once($dir.'/'.$file);
|
||||
|
||||
// Recuperation de la nouvelle reference
|
||||
$objMod = new $modName($this->db);
|
||||
// Recuperation de la nouvelle reference
|
||||
$objMod = new $modName($this->db);
|
||||
|
||||
$numref = "";
|
||||
$numref = $objMod->commande_get_num($soc,$this);
|
||||
$numref = "";
|
||||
$numref = $objMod->commande_get_num($soc,$this);
|
||||
|
||||
if ( $numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db,"CommandeFournisseur::getNextNumRef ".$obj->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON);
|
||||
return -2;
|
||||
}
|
||||
if ( $numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db,"CommandeFournisseur::getNextNumRef ".$obj->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -496,53 +495,88 @@ class CommandeFournisseur extends Commande
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Approuve une commande
|
||||
*
|
||||
* \brief Accept an order
|
||||
* \param user Object user
|
||||
*/
|
||||
function approve($user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::Approve");
|
||||
$result = 0;
|
||||
|
||||
if ($user->rights->fournisseur->commande->approuver)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 2";
|
||||
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1 ;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$result = 0;
|
||||
$this->log($user, 2, time()); // Statut 2
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$result = 0;
|
||||
$this->log($user, 2, time()); // Statut 2
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// If stock is incremented on validate order, we must increment it
|
||||
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
|
||||
|
||||
$subject = "Votre commande ".$this->ref." a <20>t<EFBFBD> approuv<75>e";
|
||||
$message = "Bonjour,\n\n";
|
||||
$message .= "Votre commande ".$this->ref." a <20>t<EFBFBD> approuv<75>e, par $user->fullname";
|
||||
$message .= "\n\nCordialement,\n\n";
|
||||
$this->_NotifyCreator($user, $subject, $message);
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrement stock of product (and sub-products)
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::valid Success");
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::Approve Error -1");
|
||||
$result = -1;
|
||||
}
|
||||
if ($error == 0)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$subject = "Votre commande ".$this->ref." a <20>t<EFBFBD> approuv<75>e";
|
||||
$message = "Bonjour,\n\n";
|
||||
$message .= "Votre commande ".$this->ref." a <20>t<EFBFBD> approuv<75>e, par $user->fullname";
|
||||
$message .= "\n\nCordialement,\n\n";
|
||||
$this->_NotifyCreator($user, $subject, $message);
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("CommandeFournisseur::Approve Error ",$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::Approve Not Authorized");
|
||||
dolibarr_syslog("CommandeFournisseur::Approve Not Authorized", LOG_ERR);
|
||||
}
|
||||
return $result ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -786,7 +820,7 @@ class CommandeFournisseur extends Commande
|
||||
$total_ttc = $tabprice[2];
|
||||
|
||||
$subprice = price2num($pu,'MU');
|
||||
|
||||
|
||||
// \TODO A virer
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
$remise = 0;
|
||||
@ -1304,7 +1338,7 @@ class CommandeFournisseur extends Commande
|
||||
{
|
||||
// Mise a jour info denormalisees au niveau facture
|
||||
$this->update_price();
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -39,12 +39,13 @@ class mod_commande_marbre extends ModeleNumRefCommandes
|
||||
var $nom='Marbre';
|
||||
|
||||
|
||||
/** \brief Renvoi la description du modele de num<EFBFBD>rotation
|
||||
/** \brief Renvoi la description du modele de numerotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
return "Renvoie le num<75>ro sous la forme ".$this->prefix."yymm-nnnn ou yy est l'annee, mm le mois et nnnn un compteur sequentiel sans rupture et sans remise e 0";
|
||||
global $langs;
|
||||
return $langs->trans("MarbreNumRefDesc",$this->prefix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/commande/mod_commande_opale.php
|
||||
\ingroup commande
|
||||
\brief Fichier contenant la classe du modèle de numérotation de référence de commande Opale
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
include_once("modules_commande.php");
|
||||
|
||||
|
||||
/**
|
||||
\class mod_commande_opale
|
||||
\brief Classe du modèle de numérotation de référence de commande Opale
|
||||
*/
|
||||
|
||||
class mod_commande_opale extends ModeleNumRefCommandes
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $error = '';
|
||||
var $nom = 'Opale';
|
||||
|
||||
|
||||
/** \brief Constructeur
|
||||
*/
|
||||
function mod_commande_opale()
|
||||
{
|
||||
$this->nom = "Opale";
|
||||
}
|
||||
|
||||
|
||||
/** \brief Renvoi la description du modele de numérotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
return "Renvoie le numéro sous la forme numérique COMhexa, où hexa représente un incrément global codé en héxadécimal. (COM-000-001 à COM-FFF-FFF)";
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
return "COM-000-001";
|
||||
}
|
||||
|
||||
|
||||
/** \brief Return next value
|
||||
* \param objsoc Objet third party
|
||||
* \param commande Object order
|
||||
* \return string Value if OK, 0 if KO
|
||||
*/
|
||||
function getNextValue($objsoc,$commande)
|
||||
{
|
||||
global $db;
|
||||
|
||||
// D'abord on récupère la valeur max (réponse immédiate car champ indéxé)
|
||||
$com='';
|
||||
$sql = "SELECT MAX(ref)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " WHERE ref like 'COM%'";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
{
|
||||
//on extrait la valeur max et on la passe en décimale
|
||||
$max = hexdec((substr($row[0],4,3)).(substr($row[0],8,3)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$max=0;
|
||||
}
|
||||
//$date=time();
|
||||
$date=$commande->date;
|
||||
$yy = strftime("%y",$date);
|
||||
$hex = strtoupper(dechex($max+1));
|
||||
$ref = substr("000000".($hex),-6);
|
||||
|
||||
return 'COM-'.substr($ref,0,3)."-".substr($ref,3,3);
|
||||
}
|
||||
|
||||
/** \brief Return next free value
|
||||
* \param objsoc Object third party
|
||||
* \param objforref Object for number to search
|
||||
* \return string Next free value
|
||||
*/
|
||||
function commande_get_num($objsoc,$objforref)
|
||||
{
|
||||
return $this->getNextValue($objsoc,$objforref);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -115,5 +115,8 @@ QtyOrdered=Qty ordered
|
||||
AddDeliveryCostLine=Add a delivery cost line indicating the weight of the order
|
||||
|
||||
|
||||
# einstein PDF Model
|
||||
# Documents models
|
||||
PDFEinsteinDescription=A complete order model (logo...)
|
||||
|
||||
# NumRef Modules
|
||||
MarbreNumRefDesc=Renvoie le numéro sous la forme %syymm-nnnn ou yy est l'annee, mm le mois et nnnn un compteur sequentiel sans rupture et sans remise e 0
|
||||
|
||||
@ -118,11 +118,4 @@ AddDeliveryCostLine=Ajouter une ligne de frais port indiquant le poids de la com
|
||||
PDFEinsteinDescription=Modèle de propositions commerciales complet (logo...)
|
||||
|
||||
# NumRef Modules
|
||||
EmeraudeNumRefModelDesc1=Renvoie le numéro sous la forme CYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1
|
||||
EmeraudeNumRefModelDesc2=L'année s'incrémente de 1 et le numéro d'incrément se remet à zero en début d'année d'exercice.
|
||||
EmeraudeNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre.
|
||||
EmeraudeNumRefModelDesc4=Dans cette exemple nous aurons au 1er septembre 2007 une commande nommée C0800001
|
||||
RubisNumRefModelDesc1=Renvoie le numéro sous la forme CYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1
|
||||
RubisNumRefModelDesc2=L'année s'incrémente de 1 SANS remise à zero en début d'année d'exercice.
|
||||
RubisNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre.
|
||||
RubisNumRefModelDesc4=Dans cette exemple nous aurons au 1er septembre 2007 une commande nommée C0800345
|
||||
MarbreNumRefDesc=Renvoie le numéro sous la forme %syymm-nnnn ou yy est l'annee, mm le mois et nnnn un compteur sequentiel sans rupture et sans remise à 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user