modif date de livraison
This commit is contained in:
parent
cc22914e31
commit
2ab9622cf8
@ -85,7 +85,7 @@ if ($_GET["action"] == 'create')
|
||||
$numpr .= "." . ($num + 1);
|
||||
}
|
||||
}
|
||||
print "<form action=\"propal.php?socidp=".$soc->id."\" method=\"post\">";
|
||||
print "<form name='addprop' action=\"propal.php?socidp=".$soc->id."\" method=\"post\">";
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@ -108,19 +108,11 @@ if ($_GET["action"] == 'create')
|
||||
print '<tr><td>'.$langs->trans("ValidityDuration").'</td><td><input name="duree_validite" size="5" value="15"> '.$langs->trans("days").'</td></tr>';
|
||||
|
||||
// date de livraison
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DateDelivery").'</td>';
|
||||
print '<td>';
|
||||
$form->select_date('','liv_');
|
||||
$form->select_date('','liv_','','','',"addprop");
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr><td>".$langs->trans("DateDelivery")."</td><td>";
|
||||
$form->select_date();
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Conditions de réglement
|
||||
print '<tr><td nowrap>'.$langs->trans('PaymentConditions').'</td><td>';
|
||||
$form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id');
|
||||
|
||||
@ -107,6 +107,14 @@ if ($_POST['action'] == 'setecheance')
|
||||
$result=$propal->set_echeance($user,mktime(12, 1, 1, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
|
||||
if ($result < 0) dolibarr_print_error($db,$propal->error);
|
||||
}
|
||||
if ($_POST['action'] == 'setdate_livraison')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$result=$propal->set_date_livraison($user,mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
||||
if ($result < 0) dolibarr_print_error($db,$propal->error);
|
||||
}
|
||||
|
||||
|
||||
if ($_POST['action'] == 'add')
|
||||
{
|
||||
@ -531,9 +539,9 @@ if ($_GET['propalid'] > 0)
|
||||
print '<td>';
|
||||
if ($propal->brouillon && $_GET['action'] == 'editecheance')
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
|
||||
print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setecheance">';
|
||||
$html->select_date($propal->fin_validite,'ech');
|
||||
$html->select_date($propal->fin_validite,'ech','','','',"editecheance");
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
@ -560,14 +568,18 @@ if ($_GET['propalid'] > 0)
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editdate_livraison' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&propalid='.$propal->id.'">'.img_edit($langs->trans('SetDateLivraison'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td colspan="5">';
|
||||
if ($_GET['action'] == 'editdate_livraison')
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'cond_reglement_id');
|
||||
print '<form name="editdate_livraison" action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setdate_livraison">';
|
||||
$html->select_date($propal->date_livraison,'liv_','','','',"editdate_livraison");
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $propal->date_livraison;
|
||||
print dolibarr_print_date($propal->date_livraison,'%a %d %B %Y');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -240,8 +240,8 @@ class Commande
|
||||
{
|
||||
$this->projetid = 0;
|
||||
}
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client, model_pdf, fk_cond_reglement, fk_mode_reglement) ';
|
||||
$sql .= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.', '.$this->db->idate($this->date_commande).', '.$this->source.', \''.$this->note.'\', \''.$this->ref_client.'\', \''.$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\')';
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client, model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison) ';
|
||||
$sql .= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.', '.$this->db->idate($this->date_commande).', '.$this->source.', \''.$this->note.'\', \''.$this->ref_client.'\', \''.$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\', \''.$this->db->idate($this->date_livraison).'\')';
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
@ -540,7 +540,7 @@ class Commande
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement';
|
||||
$sql .= ', '.$this->db->pdate('c.date_commande').' as date_commande, c.fk_projet, c.remise_percent, c.source, c.facture, c.note, c.ref_client, c.model_pdf';
|
||||
$sql .= ', '.$this->db->pdate('c.date_commande').' as date_commande, c.fk_projet, c.remise_percent, c.source, c.facture, c.note, c.ref_client, c.model_pdf, c.date_livraison';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
||||
$sql .= ' WHERE c.rowid = '.$id;
|
||||
|
||||
@ -566,6 +566,7 @@ class Commande
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->cond_reglement_id = $obj->fk_cond_reglement;
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->date_livraison = $obj->date_livraison;
|
||||
|
||||
$this->db->free();
|
||||
if ($this->statut == 0)
|
||||
@ -802,7 +803,32 @@ class Commande
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Définit une date de livraison
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param date_livraison date de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_date_livraison($user, $date_livraison)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET date_livraison = ".$this->db->idate($date_livraison);
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$this->date_livraison = $date_livraison;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Commande::set_date_livraison Erreur SQL");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* \brief Renvoi la liste des propal (éventuellement filtrée sur un user) dans un tableau
|
||||
* \param brouillon 0=non brouillon, 1=brouillon
|
||||
|
||||
@ -89,7 +89,8 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||
$commande->ref_client = $_POST['ref_client'];
|
||||
$commande->modelpdf = $_POST['model'];
|
||||
$commande->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$commande->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$commande->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$commande->date_livraison = mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
||||
|
||||
$commande->add_product($_POST['idprod1'],$_POST['qty1'],$_POST['remise_percent1']);
|
||||
$commande->add_product($_POST['idprod2'],$_POST['qty2'],$_POST['remise_percent2']);
|
||||
@ -128,6 +129,12 @@ if ($_POST['action'] == 'setnote' && $user->rights->commande->creer)
|
||||
$commande->fetch($_GET['id']);
|
||||
$commande->set_note($user, $_POST['note']);
|
||||
}
|
||||
if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$commande->set_date_livraison($user,mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setmode' && $user->rights->commande->creer)
|
||||
{
|
||||
@ -301,10 +308,10 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($obj->idp);
|
||||
|
||||
$nbrow=4;
|
||||
$nbrow=8;
|
||||
if ($conf->projet->enabled) $nbrow++;
|
||||
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<form name="crea_commande" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="soc_id" value="'.$soc->id.'">' ."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="0">';
|
||||
@ -319,7 +326,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
// Reference client
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
|
||||
print '<input type="text" name="ref_client" value=""></td>';
|
||||
print '<td rowspan="'.$nbrow.'" valign="top"><textarea name="note" wrap="soft" cols="50" rows="4"></textarea></td>';
|
||||
print '<td rowspan="'.$nbrow.'" valign="top"><textarea name="note" wrap="soft" cols="50" rows="12"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Client
|
||||
@ -327,9 +334,15 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
||||
$html->select_date();
|
||||
$html->select_date('','re','','','',"crea_commande");
|
||||
print '</td></tr>';
|
||||
|
||||
// date de livraison
|
||||
print "<tr><td>".$langs->trans("DateDelivery")."</td><td>";
|
||||
$html->select_date('','liv_','','','',"crea_commande");
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
// Conditions de réglement
|
||||
print '<tr><td nowrap>'.$langs->trans('PaymentConditions').'</td><td>';
|
||||
$html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id');
|
||||
@ -645,6 +658,29 @@ else
|
||||
print '<td colspan="2">'.dolibarr_print_date($commande->date,'%A %d %B %Y').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// date de livraison
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateDelivery');
|
||||
print '</td>';
|
||||
|
||||
if ($_GET['action'] != 'editdate_livraison' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($_GET['action'] == 'editdate_livraison')
|
||||
{
|
||||
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setdate_livraison">';
|
||||
$html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison");
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print dolibarr_print_date($commande->date_livraison,'%a %d %B %Y');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Conditions et modes de réglement
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user