New: Can open back a commercial proposal
This commit is contained in:
parent
0c32afe40b
commit
b54da5a719
@ -5,6 +5,7 @@ English Dolibarr ChangeLog
|
||||
***** ChangeLog for 3.2 compared to 3.1 *****
|
||||
|
||||
For users:
|
||||
- New: Can open back a closed commercial proposal.
|
||||
- New: show thirdparty barcode on main tab.
|
||||
- New: Can input note (private and public) during note and expenses creation.
|
||||
- New: Print ticket show invoice ref into POS module.
|
||||
|
||||
@ -89,6 +89,7 @@ $hookmanager=new HookManager($db);
|
||||
$hookmanager->callHooks(array('propalcard'));
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
@ -246,9 +247,7 @@ if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer)
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
/*
|
||||
* Creation propale
|
||||
*/
|
||||
// Create proposal
|
||||
if ($_POST['action'] == 'add' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->socid=$_POST['socid'];
|
||||
@ -382,31 +381,42 @@ if ($action == 'classifybilled')
|
||||
$object->cloture($user, 4, '');
|
||||
}
|
||||
|
||||
/*
|
||||
* Cloture de la propale
|
||||
*/
|
||||
if (GETPOST('action') == 'setstatut' && $user->rights->propale->cloturer)
|
||||
// Reopen proposal
|
||||
if ($action == 'confirm_reopen' && $user->rights->propale->cloturer)
|
||||
{
|
||||
if (! $_POST['cancel'])
|
||||
{
|
||||
if (! GETPOST('statut'))
|
||||
$object->fetch($id);
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut==2 || $object->statut==3)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")).'</div>';
|
||||
$action='statut';
|
||||
$action='statut';
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->fetch($id);
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($object->statut==1)
|
||||
{
|
||||
$object->cloture($user, $_REQUEST['statut'], $_REQUEST['note']);
|
||||
}
|
||||
$object->setStatut(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close proposal
|
||||
if ($action == 'setstatut' && $user->rights->propale->cloturer)
|
||||
{
|
||||
if (! $_POST['cancel'])
|
||||
{
|
||||
if (! GETPOST('statut'))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")).'</div>';
|
||||
$action='statut';
|
||||
$action='statut';
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->fetch($id);
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($object->statut==1)
|
||||
{
|
||||
$object->cloture($user, $_REQUEST['statut'], $_REQUEST['note']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
@ -1051,17 +1061,19 @@ if ($id > 0 || ! empty($ref))
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la propale
|
||||
*/
|
||||
// Confirm delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete','',0,1);
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne produit/service
|
||||
*/
|
||||
// Confirm reopen
|
||||
if ($action == 'reopen')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1);
|
||||
}
|
||||
|
||||
// Confirmation delete product/service line
|
||||
if ($action == 'ask_deleteline')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1);
|
||||
@ -1569,6 +1581,13 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propale->cloturer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG)?'':'#reopen').'"';
|
||||
print '>'.$langs->trans('ReOpen').'</a>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut == 1 || $object->statut == 2)
|
||||
{
|
||||
@ -1594,9 +1613,9 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Create an invoice and classify billed
|
||||
if ($conf->facture->enabled && $object->statut == 2 && $user->societe_id == 0)
|
||||
if ($object->statut == 2 && $user->societe_id == 0)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
if ($conf->facture->enabled && $user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>';
|
||||
}
|
||||
|
||||
@ -116,17 +116,17 @@ class Propal extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Class Constructor
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $socid Id third party
|
||||
* @param int $propalid Id proposal
|
||||
*/
|
||||
function Propal($DB, $socid="", $propalid=0)
|
||||
function Propal($db, $socid="", $propalid=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$this->db = $DB ;
|
||||
$this->db = $db;
|
||||
$this->socid = $socid;
|
||||
$this->id = $propalid;
|
||||
$this->products = array();
|
||||
@ -157,7 +157,7 @@ class Propal extends CommonObject
|
||||
* @param int $idproduct Product Id to add
|
||||
* @param int $qty Quantity
|
||||
* @param int $remise_percent Discount effected on Product
|
||||
*
|
||||
*
|
||||
* TODO Remplacer les appels a cette fonction par generation objet Ligne
|
||||
* insere dans tableau $this->products
|
||||
*/
|
||||
@ -303,7 +303,7 @@ class Propal extends CommonObject
|
||||
* @param int $special_code Special code
|
||||
* @param int $fk_parent_line Id of parent line
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
*
|
||||
* @see add_product
|
||||
*/
|
||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0)
|
||||
@ -828,7 +828,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Insert into DB a proposal object completely defined by its data members (ex, results from copy).
|
||||
* @param User $user User that create
|
||||
* @param User $user User that create
|
||||
* @return int Id of the new object if ok, <0 if ko
|
||||
* @see create
|
||||
*/
|
||||
@ -1249,7 +1249,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Set delivery date
|
||||
*
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param timestamp $date_livraison Delivery date
|
||||
* @return int <0 if ko, >0 if ok
|
||||
@ -1463,13 +1463,44 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Close the commercial proposal
|
||||
*
|
||||
* @param User $user Object user that close
|
||||
* @param int $statut Statut
|
||||
* @param text $note Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function reopen($user, $statut, $note)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->statut = $statut;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closure of the commercial proposal
|
||||
* @param User $user Object user that closure
|
||||
* Close the commercial proposal
|
||||
*
|
||||
* @param User $user Object user that close
|
||||
* @param int $statut Statut
|
||||
* @param text $note Commentaire
|
||||
* @return int <0 si ko, >0 si ok
|
||||
* @param text $note Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function cloture($user, $statut, $note)
|
||||
{
|
||||
@ -1477,7 +1508,7 @@ class Propal extends CommonObject
|
||||
|
||||
$this->statut = $statut;
|
||||
$error=0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
@ -1929,7 +1960,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Change source demand
|
||||
*
|
||||
*
|
||||
* @param int $demand_reason_id Id of new source demand
|
||||
* @return int >0 si ok, <0 si ko
|
||||
*/
|
||||
@ -2021,7 +2052,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Return label of status of proposal (draft, validated, ...)
|
||||
*
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
@ -2032,7 +2063,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Return label of a status (draft, validated, ...)
|
||||
*
|
||||
*
|
||||
* @param int $statut id statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
@ -2087,7 +2118,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@ -2273,7 +2304,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the reference to the following non used Proposal used depending on the active numbering module
|
||||
* defined into PROPALE_ADDON
|
||||
*
|
||||
@ -2321,7 +2352,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param string $option Where point the link
|
||||
* @param string $get_params Parametres added to url
|
||||
@ -2357,7 +2388,7 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Retrieve an array of propal lines
|
||||
*
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function getLinesArray()
|
||||
@ -2485,7 +2516,7 @@ class PropaleLigne
|
||||
|
||||
/**
|
||||
* Class line Contructor
|
||||
*
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
*/
|
||||
function PropaleLigne($DB)
|
||||
@ -2495,7 +2526,7 @@ class PropaleLigne
|
||||
|
||||
/**
|
||||
* Retrieve the propal line object
|
||||
*
|
||||
*
|
||||
* @param int $rowid propal line id
|
||||
*/
|
||||
function fetch($rowid)
|
||||
@ -2551,7 +2582,7 @@ class PropaleLigne
|
||||
|
||||
/**
|
||||
* Insert object line propal in database
|
||||
*
|
||||
*
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
@ -2560,7 +2591,7 @@ class PropaleLigne
|
||||
global $conf,$langs,$user;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
dol_syslog("PropaleLigne::insert rang=".$this->rang);
|
||||
|
||||
// Clean parameters
|
||||
@ -2686,7 +2717,7 @@ class PropaleLigne
|
||||
global $conf,$langs,$user;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
|
||||
|
||||
@ -77,7 +77,8 @@ CreateEmptyPropal=Create empty commercial proposals vierge or from list of produ
|
||||
DefaultProposalDurationValidity=Default commercial proposal validity duration (in days)
|
||||
UseCustomerContactAsPropalRecipientIfExist=Use customer contact address if defined instead of third party address as proposal recipient address
|
||||
ClonePropal=Clone commercial proposal
|
||||
ConfirmClonePropal=Are you sure you want to clone this commercial proposal <b>%s</b> ?
|
||||
ConfirmClonePropal=Are you sure you want to clone the commercial proposal <b>%s</b> ?
|
||||
ConfirmReOpenProp=Are you sure you want to open back the commercial proposal <b>%s</b> ?
|
||||
ProposalsAndProposalsLines=Commercial proposal and lines
|
||||
ProposalLine=Proposal line
|
||||
AvailabilityPeriod=Availability delay
|
||||
|
||||
@ -77,7 +77,8 @@ CreateEmptyPropal=Créer proposition/devis vierge
|
||||
DefaultProposalDurationValidity=Délai de validité par défaut (en jours)
|
||||
UseCustomerContactAsPropalRecipientIfExist=Utiliser adresse contact suivi client si défini plutôt que adresse tiers comme destinataire des propositions
|
||||
ClonePropal=Cloner proposition commerciale
|
||||
ConfirmClonePropal=Êtes-vous sûr de vouloir cloner cette proposition commerciale <b>%s</b> ?
|
||||
ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale <b>%s</b> ?
|
||||
ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale <b>%s</b> ?
|
||||
ProposalsAndProposalsLines=Propositions commerciales clientes et lignes de propositions
|
||||
ProposalLine=Ligne de proposition
|
||||
AvailabilityPeriod=Délai de livraison
|
||||
|
||||
Loading…
Reference in New Issue
Block a user