NEW The comment when closing a proposal is added to commercial proposal

This commit is contained in:
Laurent Destailleur 2017-10-18 11:23:16 +02:00
parent d40dda83cf
commit 037b90f2f3
3 changed files with 8 additions and 7 deletions

View File

@ -619,8 +619,7 @@ if (empty($reshook))
// prevent browser refresh from closing proposal several times
if ($object->statut == Propal::STATUS_VALIDATED)
{
$newprivatenote = dol_concatdesc($object->note_private, GETPOST('note_private','alpha'));
$result=$object->cloture($user, GETPOST('statut','int'), $newprivatenote);
$result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','none'));
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -1688,8 +1687,8 @@ if ($action == 'create')
//Form to close proposal (signed or not)
$formquestion = array(
array('type' => 'select','name' => 'statut','label' => $langs->trans("CloseAs"),'values' => array(2=>$object->labelstatut [2],3=>$object->labelstatut [3])),
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '') // Field to complete private note (not replace)
);
if (! empty($conf->notification->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';

View File

@ -512,7 +512,7 @@ class Proposals extends DolibarrApi
*
* @param int $id Commercial proposal ID
* @param int $status Must be 2 (accepted) or 3 (refused) {@min 2}{@max 3}
* @param string $note_private Add this mention to the private note
* @param string $note_private Add this mention at end of private note
* @param int $notrigger Disabled triggers
*
* @url POST {id}/close

View File

@ -2215,7 +2215,7 @@ class Propal extends CommonObject
*
* @param User $user Object user that close
* @param int $statut Statut
* @param string $note Comment
* @param string $note Complete private note with this note
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
@ -2228,8 +2228,10 @@ class Propal extends CommonObject
$this->db->begin();
$newprivatenote = dol_concatdesc($this->note_private, $note);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($newprivatenote)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);