Can modify proposal date if statut is draft.
This commit is contained in:
parent
1575d84844
commit
160ae055a7
@ -38,6 +38,7 @@ For users:
|
||||
- New: Can filter on social contribution type in list.
|
||||
- New: Upload of joined files need create/modify permissions to work.
|
||||
- New: For admin users, show the SQL request in export build.
|
||||
- New: Can modify proposal date if status is draft.
|
||||
- Fix: Partial payment on social contributions not shown on main page.
|
||||
- Fix: Handle correctly the comment in status changing of supplier orders.
|
||||
- Fix: Author, title and topic are correctly encoded in PDF.
|
||||
|
||||
@ -127,9 +127,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Supprime une ligne produit AVEC OU SANS confirmation
|
||||
*/
|
||||
// Remove line
|
||||
if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
||||
{
|
||||
@ -151,7 +149,7 @@ if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes
|
||||
exit;
|
||||
}
|
||||
|
||||
// Validation de la propale
|
||||
// Validation
|
||||
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' && $user->rights->propale->valider)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
@ -175,6 +173,13 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setdate')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$result=$propal->set_date($user,dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']));
|
||||
if ($result < 0) dol_print_error($db,$propal->error);
|
||||
}
|
||||
if ($_POST['action'] == 'setecheance')
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
@ -1007,9 +1012,34 @@ if ($id > 0 || ! empty($ref))
|
||||
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
|
||||
print '</td></tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
|
||||
print dol_print_date($propal->date,'daytext');
|
||||
// Date of proposal
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editdate' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&propalid='.$propal->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($propal->brouillon && $_GET['action'] == 'editdate')
|
||||
{
|
||||
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setdate">';
|
||||
$html->select_date($propal->date,'re','','',0,"editdate");
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($propal->date)
|
||||
{
|
||||
print dol_print_date($propal->date,'daytext');
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($conf->projet->enabled) $rowspan++;
|
||||
@ -1027,7 +1057,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editecheance' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editecheance&propalid='.$propal->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '<td colspan="3">';
|
||||
print '</td><td colspan="3">';
|
||||
if ($propal->brouillon && $_GET['action'] == 'editecheance')
|
||||
{
|
||||
print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
|
||||
|
||||
@ -60,6 +60,8 @@ class Propal extends CommonObject
|
||||
var $ref;
|
||||
var $ref_client;
|
||||
var $statut; // 0, 1, 2, 3, 4
|
||||
var $datec; // Date of creation
|
||||
var $datev; // Date of validation
|
||||
var $date; // Date of proposal
|
||||
var $datep; // Duplicate with date
|
||||
var $date_livraison;
|
||||
@ -705,6 +707,8 @@ class Propal extends CommonObject
|
||||
{
|
||||
$sql = "SELECT p.rowid,ref,remise,remise_percent,remise_absolue,fk_soc";
|
||||
$sql.= ", total, tva, total_ht";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", date_valid as datev";
|
||||
$sql.= ", datep as dp";
|
||||
$sql.= ", fin_validite as dfv";
|
||||
$sql.= ", date_livraison as date_livraison";
|
||||
@ -751,7 +755,9 @@ class Propal extends CommonObject
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->statut_libelle = $obj->statut_label;
|
||||
|
||||
$this->date = $this->db->jdate($obj->dp);
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
$this->date = $this->db->jdate($obj->dp); // Proposal date
|
||||
$this->datep = $this->db->jdate($obj->dp);
|
||||
$this->fin_validite = $this->db->jdate($obj->dfv);
|
||||
$this->date_livraison = $this->db->jdate($obj->date_livraison);
|
||||
@ -890,10 +896,37 @@ class Propal extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief D<EFBFBD>finit la date de fin de validit<EFBFBD>
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param date_fin_validite Date fin
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* \brief Define proposal date
|
||||
* \param user Object user that modify
|
||||
* \param date Date
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_date($user, $date)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = ".$this->db->idate($date);
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$this->date = $date;
|
||||
$this->datep = $date;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Propal::set_date Erreur SQL".$this->error, LOG_ERROR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Define end validity date
|
||||
* \param user Object user that modify
|
||||
* \param date_fin_validite End of validity date
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_echeance($user, $date_fin_validite)
|
||||
{
|
||||
@ -909,7 +942,7 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Propal::set_echeance Erreur SQL");
|
||||
dol_syslog("Propal::set_echeance Erreur SQL".$this->error, LOG_ERROR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user