Merge branch 'bug-1787' of https://github.com/marcosgdf/dolibarr into
marcosgdf-bug-1787 Conflicts: ChangeLog htdocs/comm/propal.php
This commit is contained in:
commit
b3e216b8f1
@ -12,6 +12,7 @@ English Dolibarr ChangeLog
|
|||||||
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
|
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
|
||||||
- Fix: [ bug #1804 ] SQL error when sending email without addresee
|
- Fix: [ bug #1804 ] SQL error when sending email without addresee
|
||||||
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
|
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
|
||||||
|
- Fix: [ bug #1787 ] Incorrect behaviour of doActions hook
|
||||||
|
|
||||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||||
|
|||||||
@ -121,8 +121,10 @@ $hookmanager->initHooks(array('membercard'));
|
|||||||
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
|
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
if (empty($reshook)) {
|
||||||
{
|
|
||||||
|
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||||
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
|
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
|
||||||
{
|
{
|
||||||
@ -142,10 +144,10 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
|
|||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setsocid')
|
if ($action == 'setsocid')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -177,11 +179,11 @@ if ($action == 'setsocid')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create user from a member
|
// Create user from a member
|
||||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer)
|
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer)
|
||||||
{
|
{
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Creation user
|
// Creation user
|
||||||
@ -198,11 +200,11 @@ if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user
|
|||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create third party from a member
|
// Create third party from a member
|
||||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
|
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Creation user
|
// Creation user
|
||||||
@ -220,10 +222,10 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if ($object->email)
|
if ($object->email)
|
||||||
{
|
{
|
||||||
$from=$conf->email_from;
|
$from=$conf->email_from;
|
||||||
@ -234,10 +236,10 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
|||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
$mesg=$langs->trans("MailSuccessfulySent", $from, $object->email);
|
$mesg=$langs->trans("MailSuccessfulySent", $from, $object->email);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$birthdate='';
|
$birthdate='';
|
||||||
@ -398,10 +400,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
|
|||||||
{
|
{
|
||||||
$action='edit';
|
$action='edit';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->adherent->creer)
|
if ($action == 'add' && $user->rights->adherent->creer)
|
||||||
{
|
{
|
||||||
if ($canvas) $object->canvas=$canvas;
|
if ($canvas) $object->canvas=$canvas;
|
||||||
$birthdate='';
|
$birthdate='';
|
||||||
if (isset($_POST["birthday"]) && $_POST["birthday"]
|
if (isset($_POST["birthday"]) && $_POST["birthday"]
|
||||||
@ -547,10 +549,10 @@ if ($action == 'add' && $user->rights->adherent->creer)
|
|||||||
else {
|
else {
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes')
|
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
$result=$object->delete($rowid);
|
$result=$object->delete($rowid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -569,10 +571,10 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confir
|
|||||||
{
|
{
|
||||||
$errmesg=$object->error;
|
$errmesg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes')
|
if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -611,10 +613,10 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm ==
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
|
if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
|
||||||
{
|
{
|
||||||
if ($confirm == 'yes')
|
if ($confirm == 'yes')
|
||||||
{
|
{
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
@ -645,11 +647,11 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_resign')
|
|||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPIP Management
|
// SPIP Management
|
||||||
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes')
|
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if (! count($object->errors))
|
if (! count($object->errors))
|
||||||
{
|
{
|
||||||
if (!$mailmanspip->del_to_spip($object))
|
if (!$mailmanspip->del_to_spip($object))
|
||||||
@ -657,10 +659,10 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf
|
|||||||
$errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."<BR>\n";
|
$errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."<BR>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes')
|
if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if (! count($object->errors))
|
if (! count($object->errors))
|
||||||
{
|
{
|
||||||
if (!$mailmanspip->add_to_spip($object))
|
if (!$mailmanspip->add_to_spip($object))
|
||||||
@ -668,10 +670,10 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
|
|||||||
$errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."<BR>\n";
|
$errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."<BR>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -79,11 +79,12 @@ $object = new Societe($db);
|
|||||||
$parameters = array('socid' => $id);
|
$parameters = array('socid' => $id);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
||||||
|
|
||||||
//Some actions show a "cancel" input submit button with name="cancel"
|
if (empty($reshook)) {
|
||||||
$cancelbutton = GETPOST('cancel');
|
//Some actions show a "cancel" input submit button with name="cancel"
|
||||||
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
if ($action == 'setcustomeraccountancycode')
|
if ($action == 'setcustomeraccountancycode')
|
||||||
{
|
{
|
||||||
if (!$cancelbutton) {
|
if (!$cancelbutton) {
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->code_compta=$_POST["customeraccountancycode"];
|
$object->code_compta=$_POST["customeraccountancycode"];
|
||||||
@ -94,25 +95,25 @@ if ($action == 'setcustomeraccountancycode')
|
|||||||
}
|
}
|
||||||
$action="";
|
$action="";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// conditions de reglement
|
// conditions de reglement
|
||||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
// mode de reglement
|
// mode de reglement
|
||||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
// assujetissement a la TVA
|
// assujetissement a la TVA
|
||||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->tva_assuj=$_POST['assujtva_value'];
|
$object->tva_assuj=$_POST['assujtva_value'];
|
||||||
|
|
||||||
@ -120,29 +121,29 @@ if ($action == 'setassujtva' && $user->rights->societe->creer)
|
|||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (! $result) dol_print_error($result);
|
if (! $result) dol_print_error($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set prospect level
|
// set prospect level
|
||||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||||
$result=$object->set_prospect_level($user);
|
$result=$object->set_prospect_level($user);
|
||||||
if ($result < 0) setEventMessage($object->error,'errors');
|
if ($result < 0) setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update communication level
|
// Update communication level
|
||||||
if ($action == 'cstc')
|
if ($action == 'cstc')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->stcomm_id=GETPOST('stcomm','int');
|
$object->stcomm_id=GETPOST('stcomm','int');
|
||||||
$result=$object->set_commnucation_level($user);
|
$result=$object->set_commnucation_level($user);
|
||||||
if ($result < 0) setEventMessage($object->error,'errors');
|
if ($result < 0) setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update communication level
|
// Update communication level
|
||||||
if ($action == 'setOutstandingBill')
|
if ($action == 'setOutstandingBill')
|
||||||
{
|
{
|
||||||
if (!$cancelbutton) {
|
if (!$cancelbutton) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->outstanding_limit = GETPOST('OutstandingBill');
|
$object->outstanding_limit = GETPOST('OutstandingBill');
|
||||||
@ -151,6 +152,7 @@ if ($action == 'setOutstandingBill')
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,9 +102,11 @@ $object->substitutionarrayfortest=array(
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
// Action clone object
|
if (empty($reshook)) {
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
|
||||||
{
|
// Action clone object
|
||||||
|
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||||
|
{
|
||||||
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||||
@ -123,11 +125,11 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action send emailing for everybody
|
// Action send emailing for everybody
|
||||||
if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
|
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
|
||||||
{
|
{
|
||||||
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
|
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
|
||||||
@ -378,11 +380,11 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
|||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action send test emailing
|
// Action send test emailing
|
||||||
if ($action == 'send' && empty($_POST["cancel"]))
|
if ($action == 'send' && empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||||
@ -439,11 +441,11 @@ if ($action == 'send' && empty($_POST["cancel"]))
|
|||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action add emailing
|
// Action add emailing
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$object->email_from = trim($_POST["from"]);
|
$object->email_from = trim($_POST["from"]);
|
||||||
$object->email_replyto = trim($_POST["replyto"]);
|
$object->email_replyto = trim($_POST["replyto"]);
|
||||||
$object->email_errorsto = trim($_POST["errorsto"]);
|
$object->email_errorsto = trim($_POST["errorsto"]);
|
||||||
@ -469,11 +471,11 @@ if ($action == 'add')
|
|||||||
|
|
||||||
$mesg='<div class="error">'.$mesg.'</div>';
|
$mesg='<div class="error">'.$mesg.'</div>';
|
||||||
$action="create";
|
$action="create";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action update description of emailing
|
// Action update description of emailing
|
||||||
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
|
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||||
|
|
||||||
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
|
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
|
||||||
@ -496,13 +498,13 @@ if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyt
|
|||||||
|
|
||||||
$mesg='<div class="error">'.$mesg.'</div>';
|
$mesg='<div class="error">'.$mesg.'</div>';
|
||||||
$action="";
|
$action="";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add file in email form
|
* Add file in email form
|
||||||
*/
|
*/
|
||||||
if (! empty($_POST['addfile']))
|
if (! empty($_POST['addfile']))
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
@ -511,11 +513,11 @@ if (! empty($_POST['addfile']))
|
|||||||
dol_add_file_process($upload_dir,0,0);
|
dol_add_file_process($upload_dir,0,0);
|
||||||
|
|
||||||
$action="edit";
|
$action="edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action remove file
|
// Action remove file
|
||||||
if (! empty($_POST["removedfile"]))
|
if (! empty($_POST["removedfile"]))
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
@ -523,11 +525,11 @@ if (! empty($_POST["removedfile"]))
|
|||||||
dol_remove_file_process($_POST['removedfile'],0);
|
dol_remove_file_process($_POST['removedfile'],0);
|
||||||
|
|
||||||
$action="edit";
|
$action="edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action update emailing
|
// Action update emailing
|
||||||
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
|
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$isupload=0;
|
$isupload=0;
|
||||||
@ -559,11 +561,11 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
|
|||||||
{
|
{
|
||||||
$action="edit";
|
$action="edit";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action confirmation validation
|
// Action confirmation validation
|
||||||
if ($action == 'confirm_valid' && $confirm == 'yes')
|
if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$object->valid($user);
|
$object->valid($user);
|
||||||
@ -575,11 +577,11 @@ if ($action == 'confirm_valid' && $confirm == 'yes')
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resend
|
// Resend
|
||||||
if ($action == 'confirm_reset' && $confirm == 'yes')
|
if ($action == 'confirm_reset' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -606,26 +608,26 @@ if ($action == 'confirm_reset' && $confirm == 'yes')
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action confirmation suppression
|
// Action confirmation suppression
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if ($object->delete($object->id))
|
if ($object->delete($object->id))
|
||||||
{
|
{
|
||||||
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
|
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($_POST["cancel"]))
|
if (! empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -107,10 +107,11 @@ $parameters = array('socid' => $socid);
|
|||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
||||||
// hooks
|
// hooks
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook)) {
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes') {
|
if ($action == 'confirm_clone' && $confirm == 'yes') {
|
||||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) {
|
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) {
|
||||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -125,10 +126,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete proposal
|
// Delete proposal
|
||||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) {
|
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) {
|
||||||
$result = $object->delete($user);
|
$result = $object->delete($user);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php');
|
header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php');
|
||||||
@ -137,10 +138,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->prop
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans($object->error), 'errors');
|
setEventMessage($langs->trans($object->error), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove line
|
// Remove line
|
||||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) {
|
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) {
|
||||||
$result = $object->deleteline($lineid);
|
$result = $object->deleteline($lineid);
|
||||||
// reorder lines
|
// reorder lines
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -160,10 +161,10 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) {
|
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) {
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -182,9 +183,9 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
|
|||||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
||||||
else setEventMessage($langs->trans($object->error), 'errors');
|
else setEventMessage($langs->trans($object->error), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setdate' && $user->rights->propal->creer) {
|
else if ($action == 'setdate' && $user->rights->propal->creer) {
|
||||||
$datep = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']);
|
$datep = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']);
|
||||||
|
|
||||||
if (empty($datep)) {
|
if (empty($datep)) {
|
||||||
@ -197,23 +198,23 @@ else if ($action == 'setdate' && $user->rights->propal->creer) {
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
} else if ($action == 'setecheance' && $user->rights->propal->creer) {
|
} else if ($action == 'setecheance' && $user->rights->propal->creer) {
|
||||||
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST ['echmonth'], $_POST ['echday'], $_POST ['echyear']));
|
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST ['echmonth'], $_POST ['echday'], $_POST ['echyear']));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
} else if ($action == 'setdate_livraison' && $user->rights->propal->creer) {
|
} else if ($action == 'setdate_livraison' && $user->rights->propal->creer) {
|
||||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST ['liv_month'], $_POST ['liv_day'], $_POST ['liv_year']));
|
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST ['liv_month'], $_POST ['liv_day'], $_POST ['liv_year']));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positionne ref client
|
// Positionne ref client
|
||||||
else if ($action == 'set_ref_client' && $user->rights->propal->creer) {
|
else if ($action == 'set_ref_client' && $user->rights->propal->creer) {
|
||||||
$object->set_ref_client($user, $_POST ['ref_client']);
|
$object->set_ref_client($user, $_POST ['ref_client']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create proposal
|
// Create proposal
|
||||||
else if ($action == 'add' && $user->rights->propal->creer) {
|
else if ($action == 'add' && $user->rights->propal->creer) {
|
||||||
$object->socid = $socid;
|
$object->socid = $socid;
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -345,23 +346,23 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify billed
|
// Classify billed
|
||||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
||||||
$object->cloture($user, 4, '');
|
$object->cloture($user, 4, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reopen proposal
|
// Reopen proposal
|
||||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||||
// prevent browser refresh from reopening proposal several times
|
// prevent browser refresh from reopening proposal several times
|
||||||
if ($object->statut == 2 || $object->statut == 3) {
|
if ($object->statut == 2 || $object->statut == 3) {
|
||||||
$object->reopen($user, 1);
|
$object->reopen($user, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close proposal
|
// Close proposal
|
||||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||||
if (! GETPOST('statut')) {
|
if (! GETPOST('statut')) {
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
|
||||||
$action = 'statut';
|
$action = 'statut';
|
||||||
@ -371,10 +372,10 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
|
|||||||
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add file in email form
|
// Add file in email form
|
||||||
if (GETPOST('addfile')) {
|
if (GETPOST('addfile')) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
||||||
@ -383,10 +384,10 @@ if (GETPOST('addfile')) {
|
|||||||
|
|
||||||
dol_add_file_process($upload_dir_tmp, 0, 0);
|
dol_add_file_process($upload_dir_tmp, 0, 0);
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file in email form
|
// Remove file in email form
|
||||||
if (GETPOST('removedfile')) {
|
if (GETPOST('removedfile')) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory
|
// Set tmp user directory
|
||||||
@ -396,16 +397,17 @@ if (GETPOST('removedfile')) {
|
|||||||
// TODO Delete only files that was uploaded from email form
|
// TODO Delete only files that was uploaded from email form
|
||||||
dol_remove_file_process($_POST ['removedfile'], 0);
|
dol_remove_file_process($_POST ['removedfile'], 0);
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
|
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel'))
|
||||||
|
{
|
||||||
$langs->load('mails');
|
$langs->load('mails');
|
||||||
|
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
$receiver = GETPOST('receiver');
|
$receiver = GETPOST('receiver');
|
||||||
|
|
||||||
if ($_POST ['sendto']) {
|
if ($_POST ['sendto']) {
|
||||||
@ -425,7 +427,8 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dol_strlen($sendto)) {
|
if (dol_strlen($sendto))
|
||||||
|
{
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
|
|
||||||
$from = $_POST ['fromname'] . ' <' . $_POST ['frommail'] . '>';
|
$from = $_POST ['fromname'] . ' <' . $_POST ['frommail'] . '>';
|
||||||
@ -513,10 +516,10 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
|||||||
setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors');
|
setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors');
|
||||||
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")));
|
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go back to draft
|
// Go back to draft
|
||||||
if ($action == 'modif' && $user->rights->propal->creer) {
|
if ($action == 'modif' && $user->rights->propal->creer) {
|
||||||
$object->set_draft($user);
|
$object->set_draft($user);
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -530,9 +533,9 @@ if ($action == 'modif' && $user->rights->propal->creer) {
|
|||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
|
else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
|
||||||
if ($_POST ["remise_id"]) {
|
if ($_POST ["remise_id"]) {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->insert_discount($_POST ["remise_id"]);
|
$result = $object->insert_discount($_POST ["remise_id"]);
|
||||||
@ -541,10 +544,10 @@ else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add line
|
// Add line
|
||||||
else if ($action == 'addline' && $user->rights->propal->creer) {
|
else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||||
|
|
||||||
// Set if we used free entry or predefined product
|
// Set if we used free entry or predefined product
|
||||||
$predef='';
|
$predef='';
|
||||||
@ -792,10 +795,10 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour d'une ligne dans la propale
|
// Mise a jour d'une ligne dans la propale
|
||||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) {
|
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) {
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
$info_bits = 0;
|
$info_bits = 0;
|
||||||
if (preg_match('/\*/', GETPOST('tva_tx')))
|
if (preg_match('/\*/', GETPOST('tva_tx')))
|
||||||
@ -901,15 +904,15 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
|
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
|
||||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generation doc (depuis lien ou depuis cartouche doc)
|
// Generation doc (depuis lien ou depuis cartouche doc)
|
||||||
else if ($action == 'builddoc' && $user->rights->propal->creer) {
|
else if ($action == 'builddoc' && $user->rights->propal->creer) {
|
||||||
if (GETPOST('model')) {
|
if (GETPOST('model')) {
|
||||||
$object->setDocModel($user, GETPOST('model'));
|
$object->setDocModel($user, GETPOST('model'));
|
||||||
}
|
}
|
||||||
@ -931,10 +934,10 @@ else if ($action == 'builddoc' && $user->rights->propal->creer) {
|
|||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file in doc form
|
// Remove file in doc form
|
||||||
else if ($action == 'remove_file' && $user->rights->propal->creer) {
|
else if ($action == 'remove_file' && $user->rights->propal->creer) {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -947,46 +950,46 @@ else if ($action == 'remove_file' && $user->rights->propal->creer) {
|
|||||||
else
|
else
|
||||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set project
|
// Set project
|
||||||
else if ($action == 'classin' && $user->rights->propal->creer) {
|
else if ($action == 'classin' && $user->rights->propal->creer) {
|
||||||
$object->setProject($_POST ['projectid']);
|
$object->setProject($_POST ['projectid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delai de livraison
|
// Delai de livraison
|
||||||
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
||||||
$result = $object->availability($_POST ['availability_id']);
|
$result = $object->availability($_POST ['availability_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Origine de la propale
|
// Origine de la propale
|
||||||
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
||||||
$result = $object->demand_reason($_POST ['demand_reason_id']);
|
$result = $object->demand_reason($_POST ['demand_reason_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conditions de reglement
|
// Conditions de reglement
|
||||||
else if ($action == 'setconditions' && $user->rights->propal->creer) {
|
else if ($action == 'setconditions' && $user->rights->propal->creer) {
|
||||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setremisepercent' && $user->rights->propal->creer) {
|
else if ($action == 'setremisepercent' && $user->rights->propal->creer) {
|
||||||
$result = $object->set_remise_percent($user, $_POST ['remise_percent']);
|
$result = $object->set_remise_percent($user, $_POST ['remise_percent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) {
|
else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) {
|
||||||
$result = $object->set_remise_absolue($user, $_POST ['remise_absolue']);
|
$result = $object->set_remise_absolue($user, $_POST ['remise_absolue']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mode de reglement
|
// Mode de reglement
|
||||||
else if ($action == 'setmode' && $user->rights->propal->creer) {
|
else if ($action == 'setmode' && $user->rights->propal->creer) {
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ordonnancement des lignes
|
* Ordonnancement des lignes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if ($action == 'up' && $user->rights->propal->creer) {
|
else if ($action == 'up' && $user->rights->propal->creer) {
|
||||||
$object->line_up(GETPOST('rowid'));
|
$object->line_up(GETPOST('rowid'));
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -1003,9 +1006,9 @@ else if ($action == 'up' && $user->rights->propal->creer) {
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'down' && $user->rights->propal->creer) {
|
else if ($action == 'down' && $user->rights->propal->creer) {
|
||||||
$object->line_down(GETPOST('rowid'));
|
$object->line_down(GETPOST('rowid'));
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -1022,7 +1025,7 @@ else if ($action == 'down' && $user->rights->propal->creer) {
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||||
exit();
|
exit();
|
||||||
} else if ($action == 'update_extras') {
|
} else if ($action == 'update_extras') {
|
||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
@ -1048,9 +1051,9 @@ else if ($action == 'down' && $user->rights->propal->creer) {
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) {
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) {
|
||||||
if ($action == 'addcontact') {
|
if ($action == 'addcontact') {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
@ -1091,6 +1094,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -162,11 +162,13 @@ $hookmanager->initHooks(array('prospectlist'));
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if ($action == 'cstc')
|
if (empty($reshook)) {
|
||||||
{
|
if ($action == 'cstc')
|
||||||
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
|
||||||
$sql .= " WHERE rowid = ".$_GET["socid"];
|
$sql .= " WHERE rowid = ".$_GET["socid"];
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -101,11 +101,13 @@ $permissionnote = $user->rights->commande->creer; // Used by the include of acti
|
|||||||
$parameters = array('socid' => $socid);
|
$parameters = array('socid' => $socid);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook)) {
|
||||||
|
|
||||||
// Action clone object
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
|
||||||
{
|
// Action clone object
|
||||||
|
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||||
|
{
|
||||||
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||||
@ -131,10 +133,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reopen a closed order
|
// Reopen a closed order
|
||||||
else if ($action == 'reopen' && $user->rights->commande->creer) {
|
else if ($action == 'reopen' && $user->rights->commande->creer) {
|
||||||
if ($object->statut == 3) {
|
if ($object->statut == 3) {
|
||||||
$result = $object->set_reopen($user);
|
$result = $object->set_reopen($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -147,10 +149,10 @@ else if ($action == 'reopen' && $user->rights->commande->creer) {
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suppression de la commande
|
// Suppression de la commande
|
||||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) {
|
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) {
|
||||||
$result = $object->delete($user);
|
$result = $object->delete($user);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header('Location: index.php');
|
header('Location: index.php');
|
||||||
@ -159,10 +161,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->comm
|
|||||||
else {
|
else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a product line
|
// Remove a product line
|
||||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) {
|
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) {
|
||||||
$result = $object->deleteline($lineid);
|
$result = $object->deleteline($lineid);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -188,15 +190,15 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Categorisation dans projet
|
// Categorisation dans projet
|
||||||
else if ($action == 'classin' && $user->rights->commande->creer) {
|
else if ($action == 'classin' && $user->rights->commande->creer) {
|
||||||
$object->setProject(GETPOST('projectid'));
|
$object->setProject(GETPOST('projectid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add order
|
// Add order
|
||||||
else if ($action == 'add' && $user->rights->commande->creer) {
|
else if ($action == 'add' && $user->rights->commande->creer) {
|
||||||
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||||
|
|
||||||
@ -405,27 +407,27 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
|||||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'classifybilled' && $user->rights->commande->creer)
|
else if ($action == 'classifybilled' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$ret=$object->classifyBilled();
|
$ret=$object->classifyBilled();
|
||||||
|
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positionne ref commande client
|
// Positionne ref commande client
|
||||||
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
||||||
$object->set_ref_client($user, GETPOST('ref_client'));
|
$object->set_ref_client($user, GETPOST('ref_client'));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setremise' && $user->rights->commande->creer) {
|
else if ($action == 'setremise' && $user->rights->commande->creer) {
|
||||||
$object->set_remise($user, GETPOST('remise'));
|
$object->set_remise($user, GETPOST('remise'));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
|
else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
|
||||||
if (GETPOST('remise_id')) {
|
if (GETPOST('remise_id')) {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$object->insert_discount(GETPOST('remise_id'));
|
$object->insert_discount(GETPOST('remise_id'));
|
||||||
@ -433,9 +435,9 @@ else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
|
|||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setdate' && $user->rights->commande->creer) {
|
else if ($action == 'setdate' && $user->rights->commande->creer) {
|
||||||
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||||
$date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year'));
|
$date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year'));
|
||||||
|
|
||||||
@ -443,9 +445,9 @@ else if ($action == 'setdate' && $user->rights->commande->creer) {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
||||||
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||||
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||||
|
|
||||||
@ -453,27 +455,27 @@ else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$mesg = '<div class="error">' . $object->error . '</div>';
|
$mesg = '<div class="error">' . $object->error . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setmode' && $user->rights->commande->creer) {
|
else if ($action == 'setmode' && $user->rights->commande->creer) {
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||||
$result = $object->availability(GETPOST('availability_id'));
|
$result = $object->availability(GETPOST('availability_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
else if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
||||||
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
||||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
@ -493,18 +495,18 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
|||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
|
else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
|
||||||
$result = $object->set_remise($user, GETPOST('remise_percent'));
|
$result = $object->set_remise($user, GETPOST('remise_percent'));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
|
else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
|
||||||
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
|
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new line
|
// Add a new line
|
||||||
else if ($action == 'addline' && $user->rights->commande->creer) {
|
else if ($action == 'addline' && $user->rights->commande->creer) {
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -759,12 +761,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mise a jour d'une ligne dans la commande
|
* Mise a jour d'une ligne dans la commande
|
||||||
*/
|
*/
|
||||||
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) {
|
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) {
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$date_start='';
|
$date_start='';
|
||||||
$date_end='';
|
$date_end='';
|
||||||
@ -865,14 +867,14 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
|
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
|
||||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->commande->valider) {
|
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->commande->valider) {
|
||||||
$idwarehouse = GETPOST('idwarehouse');
|
$idwarehouse = GETPOST('idwarehouse');
|
||||||
|
|
||||||
$qualified_for_stock_change=0;
|
$qualified_for_stock_change=0;
|
||||||
@ -914,10 +916,10 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
|
|||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go back to draft status
|
// Go back to draft status
|
||||||
else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
||||||
$idwarehouse = GETPOST('idwarehouse');
|
$idwarehouse = GETPOST('idwarehouse');
|
||||||
|
|
||||||
$qualified_for_stock_change=0;
|
$qualified_for_stock_change=0;
|
||||||
@ -961,16 +963,16 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
|
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
|
||||||
$result = $object->cloture($user);
|
$result = $object->cloture($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
|
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
|
||||||
$idwarehouse = GETPOST('idwarehouse');
|
$idwarehouse = GETPOST('idwarehouse');
|
||||||
|
|
||||||
$qualified_for_stock_change=0;
|
$qualified_for_stock_change=0;
|
||||||
@ -1001,13 +1003,13 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ordonnancement des lignes
|
* Ordonnancement des lignes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if ($action == 'up' && $user->rights->commande->creer) {
|
else if ($action == 'up' && $user->rights->commande->creer) {
|
||||||
$object->line_up(GETPOST('rowid'));
|
$object->line_up(GETPOST('rowid'));
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -1027,9 +1029,9 @@ else if ($action == 'up' && $user->rights->commande->creer) {
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'down' && $user->rights->commande->creer) {
|
else if ($action == 'down' && $user->rights->commande->creer) {
|
||||||
$object->line_down(GETPOST('rowid'));
|
$object->line_down(GETPOST('rowid'));
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -1048,10 +1050,10 @@ else if ($action == 'down' && $user->rights->commande->creer) {
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'builddoc') // In get or post
|
else if ($action == 'builddoc') // In get or post
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Generate order document
|
* Generate order document
|
||||||
* define into /core/modules/commande/modules_commande.php
|
* define into /core/modules/commande/modules_commande.php
|
||||||
@ -1078,10 +1080,10 @@ else if ($action == 'builddoc') // In get or post
|
|||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file in doc form
|
// Remove file in doc form
|
||||||
else if ($action == 'remove_file') {
|
else if ($action == 'remove_file') {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -1095,18 +1097,18 @@ else if ($action == 'remove_file') {
|
|||||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print file
|
// Print file
|
||||||
else if ($action == 'print_file' and $user->rights->printipp->read) {
|
else if ($action == 'print_file' and $user->rights->printipp->read) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
|
||||||
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
|
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
|
||||||
$printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
|
$printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
|
||||||
setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file')));
|
setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file')));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'update_extras') {
|
else if ($action == 'update_extras') {
|
||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
@ -1131,12 +1133,12 @@ else if ($action == 'update_extras') {
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add file in email form
|
* Add file in email form
|
||||||
*/
|
*/
|
||||||
if (GETPOST('addfile')) {
|
if (GETPOST('addfile')) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
||||||
@ -1145,12 +1147,12 @@ if (GETPOST('addfile')) {
|
|||||||
|
|
||||||
dol_add_file_process($upload_dir_tmp, 0, 0);
|
dol_add_file_process($upload_dir_tmp, 0, 0);
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove file in email form
|
* Remove file in email form
|
||||||
*/
|
*/
|
||||||
if (GETPOST('removedfile')) {
|
if (GETPOST('removedfile')) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory
|
// Set tmp user directory
|
||||||
@ -1160,12 +1162,12 @@ if (GETPOST('removedfile')) {
|
|||||||
// TODO Delete only files that was uploaded from email form
|
// TODO Delete only files that was uploaded from email form
|
||||||
dol_remove_file_process(GETPOST('removedfile'), 0);
|
dol_remove_file_process(GETPOST('removedfile'), 0);
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
|
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
|
||||||
$langs->load('mails');
|
$langs->load('mails');
|
||||||
|
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
@ -1293,9 +1295,9 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
|||||||
$mesg = '<div class="error">' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")) . '</div>';
|
$mesg = '<div class="error">' . $langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")) . '</div>';
|
||||||
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
|
dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
|
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
|
||||||
if ($action == 'addcontact') {
|
if ($action == 'addcontact') {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
@ -1335,6 +1337,7 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -111,10 +111,12 @@ $permissionnote = $user->rights->facture->creer; // Used by the include of actio
|
|||||||
$parameters = array('socid' => $socid);
|
$parameters = array('socid' => $socid);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook)) {
|
||||||
|
|
||||||
// Action clone object
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
|
||||||
|
// Action clone object
|
||||||
|
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||||
if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
||||||
$mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
|
$mesgs [] = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>';
|
||||||
} else {
|
} else {
|
||||||
@ -129,10 +131,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change status of invoice
|
// Change status of invoice
|
||||||
else if ($action == 'reopen' && $user->rights->facture->creer) {
|
else if ($action == 'reopen' && $user->rights->facture->creer) {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) {
|
if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) {
|
||||||
$result = $object->set_unpaid($user);
|
$result = $object->set_unpaid($user);
|
||||||
@ -143,10 +145,10 @@ else if ($action == 'reopen' && $user->rights->facture->creer) {
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete invoice
|
// Delete invoice
|
||||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) {
|
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -167,10 +169,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete line
|
// Delete line
|
||||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) {
|
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -199,17 +201,17 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete link of credit note to invoice
|
// Delete link of credit note to invoice
|
||||||
else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) {
|
else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) {
|
||||||
$discount = new DiscountAbsolute($db);
|
$discount = new DiscountAbsolute($db);
|
||||||
$result = $discount->fetch($_GET ["discountid"]);
|
$result = $discount->fetch($_GET ["discountid"]);
|
||||||
$discount->unlink_invoice();
|
$discount->unlink_invoice();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
else if ($action == 'valid' && $user->rights->facture->creer) {
|
else if ($action == 'valid' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
// On verifie signe facture
|
// On verifie signe facture
|
||||||
@ -226,30 +228,30 @@ else if ($action == 'valid' && $user->rights->facture->creer) {
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
|
else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setValueFrom('fk_soc', $socid);
|
$object->setValueFrom('fk_soc', $socid);
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'classin' && $user->rights->facture->creer) {
|
else if ($action == 'classin' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setProject($_POST['projectid']);
|
$object->setProject($_POST['projectid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setmode' && $user->rights->facture->creer) {
|
else if ($action == 'setmode' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$old_date_lim_reglement = $object->date_lim_reglement;
|
$old_date_lim_reglement = $object->date_lim_reglement;
|
||||||
$date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
|
$date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
|
||||||
@ -265,9 +267,9 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
|||||||
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
|
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result < 0) dol_print_error($db, $object->error);
|
if ($result < 0) dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setconditions' && $user->rights->facture->creer) {
|
else if ($action == 'setconditions' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->cond_reglement_code = 0; // To clean property
|
$object->cond_reglement_code = 0; // To clean property
|
||||||
$object->cond_reglement_id = 0; // To clean property
|
$object->cond_reglement_id = 0; // To clean property
|
||||||
@ -280,9 +282,9 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) {
|
|||||||
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
|
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result < 0) dol_print_error($db, $object->error);
|
if ($result < 0) dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
|
else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']);
|
$object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']);
|
||||||
if ($object->date_lim_reglement < $object->date) {
|
if ($object->date_lim_reglement < $object->date) {
|
||||||
@ -292,23 +294,23 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
|
|||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
|
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->revenuestamp = GETPOST('revenuestamp');
|
$object->revenuestamp = GETPOST('revenuestamp');
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
$object->update_price(1);
|
$object->update_price(1);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setremisepercent' && $user->rights->facture->creer) {
|
else if ($action == 'setremisepercent' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->set_remise($user, $_POST['remise_percent']);
|
$result = $object->set_remise($user, $_POST['remise_percent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
||||||
// POST[remise_id] ou POST[remise_id_for_payment]
|
// POST[remise_id] ou POST[remise_id_for_payment]
|
||||||
if (! empty($_POST["remise_id"])) {
|
if (! empty($_POST["remise_id"])) {
|
||||||
$ret = $object->fetch($id);
|
$ret = $object->fetch($id);
|
||||||
@ -331,16 +333,16 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
|||||||
$mesgs [] = '<div class="error">' . $discount->error . '</div>';
|
$mesgs [] = '<div class="error">' . $discount->error . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
|
else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->set_ref_client($_POST['ref_client']);
|
$object->set_ref_client($_POST['ref_client']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify to validated
|
// Classify to validated
|
||||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
|
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
|
||||||
{
|
{
|
||||||
$idwarehouse = GETPOST('idwarehouse');
|
$idwarehouse = GETPOST('idwarehouse');
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -403,10 +405,10 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
else setEventMessage($object->error, 'errors');
|
else setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go back to draft status (unvalidate)
|
// Go back to draft status (unvalidate)
|
||||||
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) {
|
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) {
|
||||||
$idwarehouse = GETPOST('idwarehouse');
|
$idwarehouse = GETPOST('idwarehouse');
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -475,15 +477,15 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify "paid"
|
// Classify "paid"
|
||||||
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) {
|
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->set_paid($user);
|
$result = $object->set_paid($user);
|
||||||
if ($result<0) setEventMessage($object->error,'errors');
|
if ($result<0) setEventMessage($object->error,'errors');
|
||||||
} // Classif "paid partialy"
|
} // Classif "paid partialy"
|
||||||
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) {
|
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$close_code = $_POST["close_code"];
|
$close_code = $_POST["close_code"];
|
||||||
$close_note = $_POST["close_note"];
|
$close_note = $_POST["close_note"];
|
||||||
@ -493,8 +495,8 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ
|
|||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
|
||||||
}
|
}
|
||||||
} // Classify "abandoned"
|
} // Classify "abandoned"
|
||||||
else if ($action == 'confirm_canceled' && $confirm == 'yes') {
|
else if ($action == 'confirm_canceled' && $confirm == 'yes') {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$close_code = $_POST["close_code"];
|
$close_code = $_POST["close_code"];
|
||||||
$close_note = $_POST["close_note"];
|
$close_note = $_POST["close_note"];
|
||||||
@ -504,11 +506,11 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes') {
|
|||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convertir en reduc
|
// Convertir en reduc
|
||||||
else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer)
|
else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
//$object->fetch_lines(); // Already done into fetch
|
//$object->fetch_lines(); // Already done into fetch
|
||||||
@ -582,13 +584,13 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert new invoice in database
|
* Insert new invoice in database
|
||||||
*/
|
*/
|
||||||
else if ($action == 'add' && $user->rights->facture->creer)
|
else if ($action == 'add' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -1053,11 +1055,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$_GET ["originid"] = $_POST["originid"];
|
$_GET ["originid"] = $_POST["originid"];
|
||||||
$mesgs [] = '<div class="error">' . $object->error . '</div>';
|
$mesgs [] = '<div class="error">' . $object->error . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new line
|
// Add a new line
|
||||||
else if ($action == 'addline' && $user->rights->facture->creer)
|
else if ($action == 'addline' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -1322,9 +1324,9 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) {
|
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) {
|
||||||
if (! $object->fetch($id) > 0)
|
if (! $object->fetch($id) > 0)
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
@ -1432,15 +1434,15 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) {
|
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) {
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify line position (up)
|
// Modify line position (up)
|
||||||
else if ($action == 'up' && $user->rights->facture->creer) {
|
else if ($action == 'up' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$object->line_up($_GET ['rowid']);
|
$object->line_up($_GET ['rowid']);
|
||||||
@ -1461,8 +1463,8 @@ else if ($action == 'up' && $user->rights->facture->creer) {
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
||||||
exit();
|
exit();
|
||||||
} // Modify line position (down)
|
} // Modify line position (down)
|
||||||
else if ($action == 'down' && $user->rights->facture->creer) {
|
else if ($action == 'down' && $user->rights->facture->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$object->line_down($_GET ['rowid']);
|
$object->line_down($_GET ['rowid']);
|
||||||
@ -1483,19 +1485,19 @@ else if ($action == 'down' && $user->rights->facture->creer) {
|
|||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link invoice to order
|
// Link invoice to order
|
||||||
if (GETPOST('linkedOrder')) {
|
if (GETPOST('linkedOrder')) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
|
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add file in email form
|
* Add file in email form
|
||||||
*/
|
*/
|
||||||
if (GETPOST('addfile')) {
|
if (GETPOST('addfile')) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory
|
// Set tmp user directory
|
||||||
@ -1504,12 +1506,12 @@ if (GETPOST('addfile')) {
|
|||||||
|
|
||||||
dol_add_file_process($upload_dir_tmp, 0, 0);
|
dol_add_file_process($upload_dir_tmp, 0, 0);
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove file in email form
|
* Remove file in email form
|
||||||
*/
|
*/
|
||||||
if (! empty($_POST['removedfile'])) {
|
if (! empty($_POST['removedfile'])) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory
|
// Set tmp user directory
|
||||||
@ -1519,12 +1521,12 @@ if (! empty($_POST['removedfile'])) {
|
|||||||
// TODO Delete only files that was uploaded from email form
|
// TODO Delete only files that was uploaded from email form
|
||||||
dol_remove_file_process($_POST['removedfile'], 0);
|
dol_remove_file_process($_POST['removedfile'], 0);
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) {
|
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) {
|
||||||
$langs->load('mails');
|
$langs->load('mails');
|
||||||
|
|
||||||
$actiontypecode = '';
|
$actiontypecode = '';
|
||||||
@ -1675,13 +1677,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate document
|
* Generate document
|
||||||
*/
|
*/
|
||||||
else if ($action == 'builddoc') // En get ou en post
|
else if ($action == 'builddoc') // En get ou en post
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -1707,10 +1709,10 @@ else if ($action == 'builddoc') // En get ou en post
|
|||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file in doc form
|
// Remove file in doc form
|
||||||
else if ($action == 'remove_file') {
|
else if ($action == 'remove_file') {
|
||||||
if ($object->fetch($id)) {
|
if ($object->fetch($id)) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -1726,18 +1728,18 @@ else if ($action == 'remove_file') {
|
|||||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print file
|
// Print file
|
||||||
else if ($action == 'print_file' and $user->rights->printipp->read) {
|
else if ($action == 'print_file' and $user->rights->printipp->read) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
|
||||||
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
|
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
|
||||||
$printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
|
$printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
|
||||||
setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file')));
|
setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file')));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
|
||||||
if ($action == 'addcontact') {
|
if ($action == 'addcontact') {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
@ -1780,9 +1782,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update_extras') {
|
if ($action == 'update_extras') {
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
@ -1807,6 +1809,7 @@ if ($action == 'update_extras') {
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -71,11 +71,13 @@ $hookmanager->initHooks(array('paiementcard'));
|
|||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
/*
|
if (empty($reshook)) {
|
||||||
|
|
||||||
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
@ -145,25 +147,25 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
|
|||||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action add_paiement
|
* Action add_paiement
|
||||||
*/
|
*/
|
||||||
if ($action == 'add_paiement')
|
if ($action == 'add_paiement')
|
||||||
{
|
{
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
// Le reste propre a cette action s'affiche en bas de page.
|
// Le reste propre a cette action s'affiche en bas de page.
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action confirm_paiement
|
* Action confirm_paiement
|
||||||
*/
|
*/
|
||||||
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
@ -244,9 +246,9 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -89,8 +89,10 @@ $hookmanager->initHooks(array('expeditioncard'));
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if ($action == 'add')
|
if (empty($reshook)) {
|
||||||
{
|
|
||||||
|
if ($action == 'add')
|
||||||
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -216,13 +218,13 @@ if ($action == 'add')
|
|||||||
$_GET["commande_id"]=GETPOST('commande_id','int');
|
$_GET["commande_id"]=GETPOST('commande_id','int');
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build a receiving receipt
|
* Build a receiving receipt
|
||||||
*/
|
*/
|
||||||
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
|
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
|
||||||
{
|
{
|
||||||
$result = $object->create_delivery($user);
|
$result = $object->create_delivery($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -233,10 +235,10 @@ else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user-
|
|||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
@ -261,10 +263,10 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
|
|||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
||||||
{
|
{
|
||||||
$result = $object->delete();
|
$result = $object->delete();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -276,19 +278,19 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expe
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans($object->error),'errors');
|
setEventMessage($langs->trans($object->error),'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
||||||
{
|
{
|
||||||
$result = $object->setStatut(0);
|
$result = $object->setStatut(0);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$mesg = $object->error;
|
$mesg = $object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
|
else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
|
||||||
{
|
{
|
||||||
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||||
$datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int'));
|
$datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int'));
|
||||||
|
|
||||||
@ -298,16 +300,16 @@ else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
|
|||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$object->error.'</div>';
|
$mesg='<div class="error">'.$object->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action update description of emailing
|
// Action update description of emailing
|
||||||
else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
||||||
|| $action == 'settrueWeight'
|
|| $action == 'settrueWeight'
|
||||||
|| $action == 'settrueWidth'
|
|| $action == 'settrueWidth'
|
||||||
|| $action == 'settrueHeight'
|
|| $action == 'settrueHeight'
|
||||||
|| $action == 'settrueDepth'
|
|| $action == 'settrueDepth'
|
||||||
|| $action == 'setshipping_method_id')
|
|| $action == 'setshipping_method_id')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
||||||
@ -335,11 +337,11 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action="";
|
$action="";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build document
|
// Build document
|
||||||
else if ($action == 'builddoc') // En get ou en post
|
else if ($action == 'builddoc') // En get ou en post
|
||||||
{
|
{
|
||||||
|
|
||||||
// Save last template used to generate document
|
// Save last template used to generate document
|
||||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||||
@ -360,11 +362,11 @@ else if ($action == 'builddoc') // En get ou en post
|
|||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete file in doc form
|
// Delete file in doc form
|
||||||
elseif ($action == 'remove_file')
|
elseif ($action == 'remove_file')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$upload_dir = $conf->expedition->dir_output . "/sending";
|
$upload_dir = $conf->expedition->dir_output . "/sending";
|
||||||
@ -372,13 +374,13 @@ elseif ($action == 'remove_file')
|
|||||||
$ret=dol_delete_file($file,0,0,0,$object);
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add file in email form
|
* Add file in email form
|
||||||
*/
|
*/
|
||||||
if (GETPOST('addfile','alpha'))
|
if (GETPOST('addfile','alpha'))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
||||||
@ -387,13 +389,13 @@ if (GETPOST('addfile','alpha'))
|
|||||||
|
|
||||||
dol_add_file_process($upload_dir_tmp,0,0);
|
dol_add_file_process($upload_dir_tmp,0,0);
|
||||||
$action ='presend';
|
$action ='presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove file in email form
|
* Remove file in email form
|
||||||
*/
|
*/
|
||||||
if (GETPOST('removedfile','alpha'))
|
if (GETPOST('removedfile','alpha'))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp user directory
|
// Set tmp user directory
|
||||||
@ -403,20 +405,20 @@ if (GETPOST('removedfile','alpha'))
|
|||||||
// TODO Delete only files that was uploaded from email form
|
// TODO Delete only files that was uploaded from email form
|
||||||
dol_remove_file_process(GETPOST('removedfile','int'),0);
|
dol_remove_file_process(GETPOST('removedfile','int'),0);
|
||||||
$action ='presend';
|
$action ='presend';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile','alpha') && ! GETPOST('cancel','alpha'))
|
if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile','alpha') && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$langs->load('mails');
|
$langs->load('mails');
|
||||||
|
|
||||||
// $ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
// if (is_readable($file))
|
// if (is_readable($file))
|
||||||
// {
|
// {
|
||||||
if (GETPOST('sendto','alpha'))
|
if (GETPOST('sendto','alpha'))
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -541,22 +543,22 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
|||||||
$action='presend';
|
$action='presend';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}
|
||||||
/* }
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'classifybilled')
|
else if ($action == 'classifybilled')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->set_billed();
|
$object->set_billed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -68,11 +68,13 @@ $hookmanager->initHooks(array('paymentsupplier'));
|
|||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
/*
|
if (empty($reshook)) {
|
||||||
|
|
||||||
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
@ -142,26 +144,26 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
|
|||||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action add_paiement
|
* Action add_paiement
|
||||||
*/
|
*/
|
||||||
if ($action == 'add_paiement')
|
if ($action == 'add_paiement')
|
||||||
{
|
{
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
// Le reste propre a cette action s'affiche en bas de page.
|
// Le reste propre a cette action s'affiche en bas de page.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action confirm_paiement
|
* Action confirm_paiement
|
||||||
*/
|
*/
|
||||||
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
@ -222,10 +224,10 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -54,12 +54,13 @@ $hookmanager->initHooks(array('suppliercard'));
|
|||||||
$parameters = array('id' => $id);
|
$parameters = array('id' => $id);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
/*
|
if (empty($reshook)) {
|
||||||
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'setsupplieraccountancycode')
|
if ($action == 'setsupplieraccountancycode')
|
||||||
{
|
{
|
||||||
$cancelbutton = GETPOST('cancel');
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
if (!$cancelbutton) {
|
if (!$cancelbutton) {
|
||||||
@ -72,23 +73,23 @@ if ($action == 'setsupplieraccountancycode')
|
|||||||
}
|
}
|
||||||
$action = "";
|
$action = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// conditions de reglement
|
// conditions de reglement
|
||||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_supplier_id','int'));
|
$result=$object->setPaymentTerms(GETPOST('cond_reglement_supplier_id','int'));
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
// mode de reglement
|
// mode de reglement
|
||||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
|
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -76,13 +76,13 @@ $modulepart='produit';
|
|||||||
$parameters=array('id'=>$id);
|
$parameters=array('id'=>$id);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
if (empty($reshook)) {
|
||||||
/*
|
/*
|
||||||
* Action envoie fichier
|
* Action envoie fichier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_pre_headers.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -82,8 +82,9 @@ if ($reshook < 0) {
|
|||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'remove_pf')
|
if (empty($reshook)) {
|
||||||
{
|
if ($action == 'remove_pf')
|
||||||
|
{
|
||||||
$product = new ProductFournisseur($db);
|
$product = new ProductFournisseur($db);
|
||||||
if ($product->fetch($id) > 0)
|
if ($product->fetch($id) > 0)
|
||||||
{
|
{
|
||||||
@ -94,10 +95,10 @@ if ($action == 'remove_pf')
|
|||||||
$mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>';
|
$mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
||||||
{
|
{
|
||||||
$id_fourn=GETPOST("id_fourn");
|
$id_fourn=GETPOST("id_fourn");
|
||||||
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
|
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
|
||||||
$ref_fourn=GETPOST("ref_fourn");
|
$ref_fourn=GETPOST("ref_fourn");
|
||||||
@ -190,17 +191,16 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('cancel') == $langs->trans("Cancel"))
|
if (GETPOST('cancel') == $langs->trans("Cancel"))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
header("Location: fournisseurs.php?id=".$_GET["id"]);
|
header("Location: fournisseurs.php?id=".$_GET["id"]);
|
||||||
exit;
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* view
|
* view
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -61,15 +61,16 @@ $hookmanager->initHooks(array('resource_card'));
|
|||||||
$parameters=array('resource_id'=>$id);
|
$parameters=array('resource_id'=>$id);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
if (empty($reshook)) {
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* ACTIONS
|
* ACTIONS
|
||||||
*
|
*
|
||||||
* Put here all code to do according to value of "action" parameter
|
* Put here all code to do according to value of "action" parameter
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write )
|
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write )
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (empty($ref))
|
if (empty($ref))
|
||||||
@ -110,9 +111,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write
|
|||||||
{
|
{
|
||||||
$action='edit';
|
$action='edit';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************
|
/***************************************************
|
||||||
* VIEW
|
* VIEW
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user