Mise en facteur de la liste des méthodes de commandes
This commit is contained in:
parent
7f829e3760
commit
abb2e8d0d2
@ -1573,6 +1573,22 @@ else
|
|||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'presend')
|
if ($_GET['action'] == 'presend')
|
||||||
{
|
{
|
||||||
|
$orderref = sanitize_string($commande->ref);
|
||||||
|
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
|
||||||
|
|
||||||
|
// Construit PDF si non existant
|
||||||
|
if (! is_readable($file))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
$result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['model'], $outputlangs);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendOrderByMail'));
|
print_titre($langs->trans('SendOrderByMail'));
|
||||||
|
|
||||||
|
|||||||
@ -56,15 +56,6 @@ if ($_POST["action"] == 'classin')
|
|||||||
$commande->fetch($_GET["id"]);
|
$commande->fetch($_GET["id"]);
|
||||||
$commande->classin($_POST["projetid"]);
|
$commande->classin($_POST["projetid"]);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($_GET["action"] == 'pdf')
|
|
||||||
{
|
|
||||||
$commande = new CommandeFournisseur($db);
|
|
||||||
$commande->fetch($_GET["id"]);
|
|
||||||
$commande->generate_pdf();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
|
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
@ -558,9 +549,9 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
if ($commande->statut == 2)
|
if ($commande->statut == 2)
|
||||||
{
|
{
|
||||||
if ($user->rights->fournisseur->commande->approuver)
|
if ($user->rights->fournisseur->commande->annuler)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&action=refuse">'.$langs->trans("RefuseOrder").'</a>';
|
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&action=cancel">'.$langs->trans("CancelOrder").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +622,7 @@ if ($_GET["id"] > 0)
|
|||||||
print '<form method="post" action="fiche.php?id='.$commande->id.'">';
|
print '<form method="post" action="fiche.php?id='.$commande->id.'">';
|
||||||
print '<input type="hidden" name="action" value="classin">';
|
print '<input type="hidden" name="action" value="classin">';
|
||||||
print '<table class="border">';
|
print '<table class="border">';
|
||||||
print '<tr><td>Projet</td><td>';
|
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
$html->select_array("projetid",$proj->liste_array($commande->soc_id));
|
$html->select_array("projetid",$proj->liste_array($commande->soc_id));
|
||||||
@ -653,20 +644,17 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<form name="commande" action="fiche.php?id='.$commande->id.'&action=commande" method="post">';
|
print '<form name="commande" action="fiche.php?id='.$commande->id.'&action=commande" method="post">';
|
||||||
print '<table class="noborder">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">Commander</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
|
||||||
print '<tr><td>Date commande</td><td>';
|
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
|
||||||
print $form->select_date('','','','','',"commande");
|
print $form->select_date('','','','','',"commande");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$commande->get_methodes_commande();
|
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
|
||||||
|
$html->select_methodes_commande('',"methodecommande",1);
|
||||||
print '<tr><td>Méthode de commande</td><td>';
|
|
||||||
|
|
||||||
print $form->select_array("methodecommande",$commande->methodes_commande);
|
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>Commentaire</td><td><input size="30" type="text" name="commentaire"></td></tr>';
|
|
||||||
|
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="commentaire"></td></tr>';
|
||||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button" name="'.$langs->trans("Activate").'"></td></tr>';
|
print '<tr><td align="center" colspan="2"><input type="submit" class="button" name="'.$langs->trans("Activate").'"></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -400,9 +400,9 @@ class CommandeFournisseur extends Commande
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Approuve une commande
|
* \brief Approuve une commande
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function approve($user)
|
function approve($user)
|
||||||
@ -439,6 +439,7 @@ class CommandeFournisseur extends Commande
|
|||||||
}
|
}
|
||||||
return $result ;
|
return $result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refuse une commande
|
* Refuse une commande
|
||||||
*
|
*
|
||||||
|
|||||||
@ -252,6 +252,43 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function select_methodes_commande($selected='',$htmlname='source_id',$addempty=0)
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
$listemethodes=array();
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, libelle ";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_methode_commande_fournisseur";
|
||||||
|
$sql.= " WHERE active = 1";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$num = $this->db->num_rows();
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$row = $this->db->fetch_row();
|
||||||
|
|
||||||
|
$listemethodes[$row[0]] = $row[1];
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
print $this->select_array($htmlname,$listemethodes,$selected,$addempty);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste déroulante des pays actifs, dans la langue de l'utilisateur
|
* \brief Retourne la liste déroulante des pays actifs, dans la langue de l'utilisateur
|
||||||
* \param selected Code pays pré-sélectionné
|
* \param selected Code pays pré-sélectionné
|
||||||
@ -2070,7 +2107,7 @@ class Form
|
|||||||
\param htmlname Nom de la zone select
|
\param htmlname Nom de la zone select
|
||||||
\param array Tableau de key+valeur
|
\param array Tableau de key+valeur
|
||||||
\param id Key pré-sélectionnée
|
\param id Key pré-sélectionnée
|
||||||
\param show_empty 1 si il faut un valeur " " dans la liste, 0 sinon
|
\param show_empty 1 si il faut ajouter une valeur " " dans la liste, 0 sinon
|
||||||
\param key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
\param key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
||||||
\param value_as_key 1 pour utiliser la valeur comme clé
|
\param value_as_key 1 pour utiliser la valeur comme clé
|
||||||
*/
|
*/
|
||||||
@ -2078,15 +2115,9 @@ class Form
|
|||||||
{
|
{
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
|
|
||||||
$i = 0;
|
if ($show_empty)
|
||||||
|
|
||||||
if (strlen($id))
|
|
||||||
{
|
{
|
||||||
if ($show_empty == 1)
|
print '<option value="-1"'.($id==-1?' selected="true"':'').'> </option>'."\n";
|
||||||
{
|
|
||||||
$array[0] = " ";
|
|
||||||
}
|
|
||||||
reset($array);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (list($key, $value) = each ($array))
|
while (list($key, $value) = each ($array))
|
||||||
|
|||||||
@ -63,6 +63,8 @@ RefCdeClient=Ref. customer order
|
|||||||
RefCdeClientShort=Ref. cust. order
|
RefCdeClientShort=Ref. cust. order
|
||||||
SendPropalByMail=Send order by mail
|
SendPropalByMail=Send order by mail
|
||||||
ActionsOnOrder=Actions on order
|
ActionsOnOrder=Actions on order
|
||||||
|
NoArticleOfTypeProduct=No article of type 'product' so no shippable article for this order
|
||||||
|
OrderMode=Order method
|
||||||
# Sources
|
# Sources
|
||||||
OrderSource0=Commercial proposal
|
OrderSource0=Commercial proposal
|
||||||
OrderSource1=Internet
|
OrderSource1=Internet
|
||||||
|
|||||||
@ -64,6 +64,7 @@ RefCdeClientShort=R
|
|||||||
SendOrderByMail=Envoi commande par mail
|
SendOrderByMail=Envoi commande par mail
|
||||||
ActionsOnOrder=Actions sur la commande
|
ActionsOnOrder=Actions sur la commande
|
||||||
NoArticleOfTypeProduct=Pas d'article de type 'produit' et donc expédiable dans cette commande
|
NoArticleOfTypeProduct=Pas d'article de type 'produit' et donc expédiable dans cette commande
|
||||||
|
OrderMode=Méthode de commande
|
||||||
# Sources
|
# Sources
|
||||||
OrderSource0=Proposition commerciale
|
OrderSource0=Proposition commerciale
|
||||||
OrderSource1=Internet
|
OrderSource1=Internet
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user