Merge remote-tracking branch 'origin/3.7' into develop
Conflicts: htdocs/comm/card.php htdocs/comm/propal.php htdocs/commande/card.php htdocs/compta/facture.php htdocs/compta/prelevement/class/bonprelevement.class.php htdocs/core/class/html.formcompany.class.php htdocs/custom/.gitignore htdocs/expedition/card.php htdocs/fourn/card.php htdocs/product/fournisseurs.php
This commit is contained in:
commit
e220ce5a82
@ -52,6 +52,9 @@ http://www.fsf.org/licensing/licenses/index_html
|
|||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
Copyright (C) 2015
|
||||||
|
- Marcos García <marcosgdf@gmail.com>
|
||||||
|
|
||||||
Copyright (C) 2014
|
Copyright (C) 2014
|
||||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
|||||||
14
ChangeLog
14
ChangeLog
@ -193,6 +193,18 @@ Dolibarr better:
|
|||||||
- Fix: ref_ext was not saved when recording a customer order from web service
|
- Fix: ref_ext was not saved when recording a customer order from web service
|
||||||
- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
|
- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
|
||||||
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
|
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
|
||||||
|
- Fix: [ bug #1788 ] Duplicated doActions hook in product/fournisseurs.php
|
||||||
|
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
|
||||||
|
- Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules
|
||||||
|
- Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database
|
||||||
|
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
|
||||||
|
- Fix: [ bug #1804 ] SQL error when sending email without addresee
|
||||||
|
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
|
||||||
|
- Fix: [ bug #1787 ] Incorrect behaviour of doActions hook
|
||||||
|
- Fix: [ bug #1796 ] Unable to use numeration modules from an external module
|
||||||
|
- Fix: [ bug #1783 ] SQL error when enabling 3rd party module with PostgreSQL and MySQL strict mode ON
|
||||||
|
- Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount
|
||||||
|
- Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme
|
||||||
|
|
||||||
***** 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.
|
||||||
@ -357,6 +369,8 @@ Fix: Paypal link were broken dur to SSL v3 closed.
|
|||||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||||
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
|
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
|
||||||
Fix: [ bug #1757 ] Sorting breaks product/service statistics
|
Fix: [ bug #1757 ] Sorting breaks product/service statistics
|
||||||
|
Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date
|
||||||
|
Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled
|
||||||
|
|
||||||
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
||||||
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
||||||
|
|||||||
@ -11,7 +11,6 @@ beta version of Dolibarr, step by step.
|
|||||||
- Update version/info in /ChangeLog
|
- Update version/info in /ChangeLog
|
||||||
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
||||||
- Update version number with x.y.z-w in build/debian/changelog
|
- Update version number with x.y.z-w in build/debian/changelog
|
||||||
- Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss
|
|
||||||
- Update version number with x.y.z-w in build/rpm/*.spec
|
- Update version number with x.y.z-w in build/rpm/*.spec
|
||||||
- Commit all changes.
|
- Commit all changes.
|
||||||
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
||||||
@ -30,10 +29,9 @@ This files describe steps made by Dolibarr packaging team to make a
|
|||||||
complete release of Dolibarr, step by step.
|
complete release of Dolibarr, step by step.
|
||||||
|
|
||||||
- Check all files are commited.
|
- Check all files are commited.
|
||||||
- Update version/info in ChangeLog
|
- Update version/info in ChangeLog. To generate a changelog, you can do "git log x.y.z..HEAD --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^Fix\|New\|Sec'"
|
||||||
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
||||||
- Update version number with x.y.z in build/debian/changelog
|
- Update version number with x.y.z in build/debian/changelog
|
||||||
- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
|
|
||||||
- Update version number with x.y.z in build/rpm/*.spec
|
- Update version number with x.y.z in build/rpm/*.spec
|
||||||
- Commit all changes.
|
- Commit all changes.
|
||||||
|
|
||||||
|
|||||||
@ -119,8 +119,10 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
@ -140,10 +142,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)
|
||||||
{
|
{
|
||||||
@ -175,11 +177,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
|
||||||
@ -196,11 +198,11 @@ if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user
|
|||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@ -218,10 +220,10 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
@ -232,10 +234,10 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
|||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
setEventMessage($langs->trans("MailSuccessfulySent", $from, $object->email));
|
setEventMessage($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='';
|
||||||
@ -397,10 +399,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"]
|
||||||
@ -549,10 +551,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)
|
||||||
{
|
{
|
||||||
@ -571,10 +573,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();
|
||||||
@ -616,10 +618,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')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ($confirm == 'yes')
|
if ($confirm == 'yes')
|
||||||
@ -658,11 +660,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))
|
||||||
@ -670,10 +672,10 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf
|
|||||||
setEventMessage($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, 'errors');
|
setEventMessage($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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))
|
||||||
@ -681,10 +683,10 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
|
|||||||
setEventMessage($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, 'errors');
|
setEventMessage($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -118,6 +118,13 @@ class ActionComm extends CommonObject
|
|||||||
$error=0;
|
$error=0;
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (empty($this->userownerid))
|
||||||
|
{
|
||||||
|
$this->errors[]='ErrorPropertyUserowneridNotDefined';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label=dol_trunc(trim($this->label),128);
|
$this->label=dol_trunc(trim($this->label),128);
|
||||||
$this->location=dol_trunc(trim($this->location),128);
|
$this->location=dol_trunc(trim($this->location),128);
|
||||||
@ -148,8 +155,9 @@ class ActionComm extends CommonObject
|
|||||||
$userownerid=$this->userownerid;
|
$userownerid=$this->userownerid;
|
||||||
$userdoneid=$this->userdoneid;
|
$userdoneid=$this->userdoneid;
|
||||||
|
|
||||||
// Be sure assigned user array is not empty.
|
// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
|
||||||
if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid);
|
if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned))
|
||||||
|
$this->userassigned = array($userownerid=>array('id'=>$userownerid));
|
||||||
|
|
||||||
if (! $this->type_id || ! $this->type_code)
|
if (! $this->type_id || ! $this->type_code)
|
||||||
{
|
{
|
||||||
@ -236,6 +244,12 @@ class ActionComm extends CommonObject
|
|||||||
{
|
{
|
||||||
foreach($this->userassigned as $key => $val)
|
foreach($this->userassigned as $key => $val)
|
||||||
{
|
{
|
||||||
|
if (! is_array($val)) // For backward compatibility when val=id
|
||||||
|
{
|
||||||
|
$tmpid=$val;
|
||||||
|
$val=array('id'=>$val);
|
||||||
|
}
|
||||||
|
|
||||||
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")";
|
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")";
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="nom";
|
if (! $sortfield) $sortfield="nom";
|
||||||
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('commcard','globalcard'));
|
$hookmanager->initHooks(array('commcard','globalcard'));
|
||||||
@ -80,12 +81,14 @@ $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
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
//Some actions show a "cancel" input submit button with name="cancel"
|
if (empty($reshook))
|
||||||
$cancelbutton = GETPOST('cancel');
|
|
||||||
|
|
||||||
if ($action == 'setcustomeraccountancycode')
|
|
||||||
{
|
{
|
||||||
if (! $cancelbutton)
|
if ($cancelbutton)
|
||||||
|
{
|
||||||
|
$action="";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'setcustomeraccountancycode')
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->code_compta=$_POST["customeraccountancycode"];
|
$object->code_compta=$_POST["customeraccountancycode"];
|
||||||
@ -95,56 +98,52 @@ if ($action == 'setcustomeraccountancycode')
|
|||||||
setEventMessage($object->errors, 'errors');
|
setEventMessage($object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$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'];
|
||||||
$result=$object->update($object->id);
|
$result=$object->update($object->id);
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 prospect level
|
// update prospect 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 outstandng limit
|
// update outstandng limit
|
||||||
if ($action == 'setOutstandingBill')
|
if ($action == 'setOutstandingBill')
|
||||||
{
|
|
||||||
if (!$cancelbutton)
|
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->outstanding_limit=GETPOST('OutstandingBill');
|
$object->outstanding_limit=GETPOST('OutstandingBill');
|
||||||
|
|||||||
@ -110,9 +110,11 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// 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"]))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||||
@ -131,11 +133,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))
|
||||||
{
|
{
|
||||||
//TODO: What is this for?
|
//TODO: What is this for?
|
||||||
@ -387,11 +389,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);
|
||||||
@ -448,11 +450,11 @@ if ($action == 'send' && empty($_POST["cancel"]))
|
|||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action add emailing
|
// Action add emailing
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$mesgs = array();
|
$mesgs = array();
|
||||||
|
|
||||||
$object->email_from = trim($_POST["from"]);
|
$object->email_from = trim($_POST["from"]);
|
||||||
@ -486,11 +488,11 @@ if ($action == 'add')
|
|||||||
|
|
||||||
setEventMessage($mesgs, 'errors');
|
setEventMessage($mesgs, 'errors');
|
||||||
$action="create";
|
$action="create";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action update description of emailing
|
// Action update description of emailing
|
||||||
if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
if ($action == 'settitre' || $action == 'setemail_from' || $action == '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'));
|
||||||
@ -516,13 +518,13 @@ if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyt
|
|||||||
|
|
||||||
setEventMessage($mesg, 'errors');
|
setEventMessage($mesg, 'errors');
|
||||||
$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';
|
||||||
@ -531,11 +533,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';
|
||||||
@ -543,11 +545,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;
|
||||||
@ -585,11 +587,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);
|
||||||
@ -601,11 +603,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();
|
||||||
@ -632,37 +634,36 @@ 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 : 'list.php');
|
$url= (! empty($urlfrom) ? $urlfrom : 'list.php');
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($_POST["cancel"]))
|
if (! empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$htmlother = new FormOther($db);
|
||||||
|
|
||||||
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
|
||||||
llxHeader('',$langs->trans("Mailing"),$help_url);
|
llxHeader('',$langs->trans("Mailing"),$help_url);
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$htmlother = new FormOther($db);
|
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
// EMailing in creation mode
|
// EMailing in creation mode
|
||||||
|
|||||||
@ -108,11 +108,13 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook))
|
||||||
|
|
||||||
// Action clone object
|
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
|
||||||
{
|
{
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
|
// Action clone object
|
||||||
|
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');
|
||||||
@ -130,11 +132,11 @@ 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');
|
||||||
@ -143,11 +145,11 @@ 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)
|
||||||
@ -167,11 +169,11 @@ 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)
|
||||||
{
|
{
|
||||||
@ -199,10 +201,10 @@ 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)) {
|
||||||
@ -215,29 +217,29 @@ 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();
|
||||||
|
|
||||||
@ -522,23 +524,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 || $object->statut == 4) {
|
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
|
||||||
$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';
|
||||||
@ -548,27 +550,53 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
|
|||||||
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
// Classify billed
|
||||||
|
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
||||||
|
$object->cloture($user, 4, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reopen proposal
|
||||||
|
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||||
|
// prevent browser refresh from reopening proposal several times
|
||||||
|
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
|
||||||
|
$object->reopen($user, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close proposal
|
||||||
|
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||||
|
if (! GETPOST('statut')) {
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
|
||||||
|
$action = 'statut';
|
||||||
|
} else {
|
||||||
|
// prevent browser refresh from closing proposal several times
|
||||||
|
if ($object->statut == 1) {
|
||||||
|
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$actiontypecode='AC_PROP';
|
$actiontypecode='AC_PROP';
|
||||||
$trigger_name='PROPAL_SENTBYMAIL';
|
$trigger_name='PROPAL_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfromproposal';
|
$mode='emailfromproposal';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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))
|
||||||
@ -583,9 +611,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
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($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"]);
|
||||||
@ -594,10 +622,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='';
|
||||||
@ -834,10 +862,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')))
|
||||||
@ -943,15 +971,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'));
|
||||||
}
|
}
|
||||||
@ -973,10 +1001,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';
|
||||||
|
|
||||||
@ -989,56 +1017,56 @@ 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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// shipping method
|
// shipping method
|
||||||
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
||||||
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
$result=$object->setShippingMethod(GETPOST('shipping_method_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)) {
|
||||||
@ -1055,9 +1083,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)) {
|
||||||
@ -1074,7 +1102,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'));
|
||||||
@ -1100,10 +1128,10 @@ 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) {
|
||||||
@ -1145,6 +1173,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2550,21 +2550,18 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
|
||||||
foreach ($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
$file = $conf->global->PROPALE_ADDON.".php";
|
$file = $conf->global->PROPALE_ADDON.".php";
|
||||||
$classname = $conf->global->PROPALE_ADDON;
|
$classname = $conf->global->PROPALE_ADDON;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
foreach ($dirmodels as $reldir) {
|
||||||
$dir = $dirroot.$reldir."/core/modules/propale/";
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/propale/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -177,11 +177,13 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,11 +102,13 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook))
|
||||||
|
|
||||||
// Action clone object
|
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
|
||||||
{
|
{
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
|
// 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'))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||||
@ -132,10 +134,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)
|
||||||
@ -148,10 +150,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');
|
||||||
@ -160,10 +162,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
|
||||||
@ -189,15 +191,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'));
|
||||||
|
|
||||||
@ -407,27 +409,27 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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'));
|
||||||
@ -435,9 +437,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'));
|
||||||
|
|
||||||
@ -445,9 +447,9 @@ else if ($action == 'setdate' && $user->rights->commande->creer) {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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'));
|
||||||
|
|
||||||
@ -455,27 +457,27 @@ else if ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -495,28 +497,28 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
|||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// shipping method
|
// shipping method
|
||||||
else if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
else if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -768,12 +770,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='';
|
||||||
@ -874,14 +876,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;
|
||||||
@ -927,10 +929,10 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
@ -976,16 +978,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;
|
||||||
@ -1016,13 +1018,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
|
||||||
@ -1043,9 +1045,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
|
||||||
@ -1065,10 +1067,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
|
||||||
@ -1095,10 +1097,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';
|
||||||
|
|
||||||
@ -1112,9 +1114,9 @@ else if ($action == 'remove_file') {
|
|||||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
$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'));
|
||||||
@ -1139,25 +1141,25 @@ else if ($action == 'update_extras') {
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$actiontypecode='AC_COM';
|
$actiontypecode='AC_COM';
|
||||||
$trigger_name='ORDER_SENTBYMAIL';
|
$trigger_name='ORDER_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfromorder';
|
$mode='emailfromorder';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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'));
|
||||||
@ -1197,8 +1199,10 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -141,20 +141,19 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($conf->global->COMMANDE_ADDON))
|
if (! empty($conf->global->COMMANDE_ADDON))
|
||||||
{
|
{
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
|
||||||
foreach ($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
$file = $conf->global->COMMANDE_ADDON.".php";
|
$file = $conf->global->COMMANDE_ADDON.".php";
|
||||||
$classname = $conf->global->COMMANDE_ADDON;
|
$classname = $conf->global->COMMANDE_ADDON;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = $dirroot.$reldir."/core/modules/commande/";
|
$dir = dol_buildpath($reldir."core/modules/commande/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -106,6 +106,7 @@ $hookmanager->initHooks(array('invoicecard','globalcard'));
|
|||||||
|
|
||||||
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -114,13 +115,15 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
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' && $user->rights->facture->creer) {
|
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 {
|
||||||
if ($object->fetch($id) > 0) {
|
if ($object->fetch($id) > 0) {
|
||||||
$result = $object->createFromClone($socid);
|
$result = $object->createFromClone($socid);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
@ -131,11 +134,11 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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);
|
||||||
@ -146,10 +149,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();
|
||||||
|
|
||||||
@ -170,11 +173,11 @@ 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();
|
||||||
|
|
||||||
@ -203,19 +206,19 @@ 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(GETPOST("discountid"));
|
$result = $discount->fetch(GETPOST("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
|
||||||
@ -232,33 +235,33 @@ 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']);
|
||||||
@ -274,10 +277,10 @@ 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
|
||||||
@ -290,10 +293,10 @@ 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) {
|
||||||
@ -303,32 +306,32 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -351,17 +354,17 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
|||||||
setEventMessage($discount->error, 'errors');
|
setEventMessage($discount->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -430,11 +433,11 @@ 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);
|
||||||
@ -507,17 +510,17 @@ 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"];
|
||||||
@ -527,8 +530,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"];
|
||||||
@ -538,11 +541,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
|
||||||
@ -615,13 +618,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();
|
||||||
@ -838,7 +841,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$object->remise_absolue = $_POST['remise_absolue'];
|
$object->remise_absolue = $_POST['remise_absolue'];
|
||||||
$object->remise_percent = $_POST['remise_percent'];
|
$object->remise_percent = $_POST['remise_percent'];
|
||||||
|
|
||||||
if($_POST['type'] == Facture::TYPE_SITUATION) {
|
if (GETPOST('type') == Facture::TYPE_SITUATION)
|
||||||
|
{
|
||||||
$object->situation_counter = 1;
|
$object->situation_counter = 1;
|
||||||
$object->situation_final = 0;
|
$object->situation_final = 0;
|
||||||
$object->situation_cycle_ref = $object->newCycle();
|
$object->situation_cycle_ref = $object->newCycle();
|
||||||
@ -1097,7 +1101,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['type'] == Facture::TYPE_SITUATION && (!empty($_POST['situations']))) {
|
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
|
||||||
|
{
|
||||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
if (empty($datefacture)) {
|
if (empty($datefacture)) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -1150,11 +1155,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$_GET["originid"] = $_POST["originid"];
|
$_GET["originid"] = $_POST["originid"];
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
@ -1418,10 +1423,10 @@ 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) dol_print_error($db);
|
if (! $object->fetch($id) > 0) dol_print_error($db);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -1465,7 +1470,8 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
$line->fetch(GETPOST('lineid'));
|
$line->fetch(GETPOST('lineid'));
|
||||||
$percent = $line->get_prev_progress();
|
$percent = $line->get_prev_progress();
|
||||||
|
|
||||||
if (GETPOST('progress') < $percent) {
|
if (GETPOST('progress') < $percent)
|
||||||
|
{
|
||||||
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$error++;
|
$error++;
|
||||||
@ -1474,7 +1480,8 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
|
|
||||||
// Check minimum price
|
// Check minimum price
|
||||||
$productid = GETPOST('productid', 'int');
|
$productid = GETPOST('productid', 'int');
|
||||||
if (! empty($productid)) {
|
if (! empty($productid))
|
||||||
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
$product->fetch($productid);
|
$product->fetch($productid);
|
||||||
|
|
||||||
@ -1543,18 +1550,38 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
unset($_POST['buying_price']);
|
unset($_POST['buying_price']);
|
||||||
unset($_POST['np_marginRate']);
|
unset($_POST['np_marginRate']);
|
||||||
unset($_POST['np_markRate']);
|
unset($_POST['np_markRate']);
|
||||||
|
|
||||||
|
unset($_POST['dp_desc']);
|
||||||
|
unset($_POST['idprod']);
|
||||||
|
|
||||||
|
unset($_POST['date_starthour']);
|
||||||
|
unset($_POST['date_startmin']);
|
||||||
|
unset($_POST['date_startsec']);
|
||||||
|
unset($_POST['date_startday']);
|
||||||
|
unset($_POST['date_startmonth']);
|
||||||
|
unset($_POST['date_startyear']);
|
||||||
|
unset($_POST['date_endhour']);
|
||||||
|
unset($_POST['date_endmin']);
|
||||||
|
unset($_POST['date_endsec']);
|
||||||
|
unset($_POST['date_endday']);
|
||||||
|
unset($_POST['date_endmonth']);
|
||||||
|
unset($_POST['date_endyear']);
|
||||||
|
|
||||||
unset($_POST['situations']);
|
unset($_POST['situations']);
|
||||||
unset($_POST['progress']);
|
unset($_POST['progress']);
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'updatealllines' && $user->rights->facture->creer && $_POST['all_percent'] == $langs->trans('Modifier')) {
|
else if ($action == 'updatealllines' && $user->rights->facture->creer && $_POST['all_percent'] == $langs->trans('Modifier'))
|
||||||
|
{
|
||||||
if (!$object->fetch($id) > 0) dol_print_error($db);
|
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||||
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "") {
|
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||||
foreach ($object->lines as $line) {
|
{
|
||||||
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
$percent = $line->get_prev_progress();
|
$percent = $line->get_prev_progress();
|
||||||
if (GETPOST('all_progress') < $percent) {
|
if (GETPOST('all_progress') < $percent) {
|
||||||
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||||
@ -1563,15 +1590,15 @@ else if ($action == 'updatealllines' && $user->rights->facture->creer && $_POST[
|
|||||||
$object->update_percent($line, $_POST['all_progress']);
|
$object->update_percent($line, $_POST['all_progress']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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']);
|
||||||
@ -1593,8 +1620,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']);
|
||||||
@ -1616,34 +1643,34 @@ 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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
if (empty($id)) $id=$facid;
|
if (empty($id)) $id=$facid;
|
||||||
$actiontypecode='AC_FAC';
|
$actiontypecode='AC_FAC';
|
||||||
$trigger_name='BILL_SENTBYMAIL';
|
$trigger_name='BILL_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfrominvoice';
|
$mode='emailfrominvoice';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate document
|
* Generate document
|
||||||
*/
|
*/
|
||||||
if ($action == 'builddoc') // En get ou en post
|
if ($action == 'builddoc') // En get ou en post
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -1669,10 +1696,10 @@ 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';
|
||||||
|
|
||||||
@ -1688,12 +1715,12 @@ else if ($action == 'remove_file') {
|
|||||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
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);
|
||||||
@ -1717,7 +1744,8 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// bascule du statut d'un contact
|
||||||
else if ($action == 'swapstatut') {
|
else if ($action == 'swapstatut')
|
||||||
|
{
|
||||||
if ($object->fetch($id)) {
|
if ($object->fetch($id)) {
|
||||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||||
} else {
|
} else {
|
||||||
@ -1726,7 +1754,8 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Efface un contact
|
||||||
else if ($action == 'deletecontact') {
|
else if ($action == 'deletecontact')
|
||||||
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->delete_contact($lineid);
|
$result = $object->delete_contact($lineid);
|
||||||
|
|
||||||
@ -1737,9 +1766,10 @@ 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'));
|
||||||
@ -1764,10 +1794,11 @@ if ($action == 'update_extras') {
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -2037,6 +2068,8 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||||
{
|
{
|
||||||
// First situation invoice
|
// First situation invoice
|
||||||
print '<tr height="18"><td width="16px" valign="middle">';
|
print '<tr height="18"><td width="16px" valign="middle">';
|
||||||
@ -2060,6 +2093,7 @@ if ($action == 'create')
|
|||||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1);
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1);
|
||||||
print $desc;
|
print $desc;
|
||||||
print '</td></tr>' . "\n";
|
print '</td></tr>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Replacement
|
// Replacement
|
||||||
print '<tr height="18"><td valign="middle">';
|
print '<tr height="18"><td valign="middle">';
|
||||||
@ -2372,7 +2406,7 @@ if ($action == 'create')
|
|||||||
// Button "Create Draft"
|
// Button "Create Draft"
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -3194,7 +3228,10 @@ if ($action == 'create')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Situations
|
// Situations
|
||||||
if ($object->type == 5 && ($object->situation_counter > 1)) {
|
if (! empty($conf->global->INVOICE_US_SITUATION))
|
||||||
|
{
|
||||||
|
if ($object->type == 5 && ($object->situation_counter > 1))
|
||||||
|
{
|
||||||
$prevsits = $object->get_prev_sits();
|
$prevsits = $object->get_prev_sits();
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans('SituationAmount');
|
print $langs->trans('SituationAmount');
|
||||||
@ -3236,6 +3273,7 @@ if ($action == 'create')
|
|||||||
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
||||||
@ -3334,6 +3372,13 @@ if ($action == 'create')
|
|||||||
// Lines
|
// Lines
|
||||||
$result = $object->getLinesArray();
|
$result = $object->getLinesArray();
|
||||||
|
|
||||||
|
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST">
|
||||||
|
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
|
||||||
|
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateligne') . '">
|
||||||
|
<input type="hidden" name="mode" value="">
|
||||||
|
<input type="hidden" name="id" value="' . $object->id . '">
|
||||||
|
';
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
|
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||||
}
|
}
|
||||||
@ -3341,6 +3386,8 @@ if ($action == 'create')
|
|||||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||||
|
|
||||||
// Show global modifiers
|
// Show global modifiers
|
||||||
|
if (! empty($conf->global->INVOICE_US_SITUATION))
|
||||||
|
{
|
||||||
if ($object->situation_cycle_ref && $object->statut == 0) {
|
if ($object->situation_cycle_ref && $object->statut == 0) {
|
||||||
print '<tr class="liste_titre nodrag nodrop">';
|
print '<tr class="liste_titre nodrag nodrop">';
|
||||||
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">';
|
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">';
|
||||||
@ -3385,13 +3432,7 @@ if ($action == 'create')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST">
|
|
||||||
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
|
|
||||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateligne') . '">
|
|
||||||
<input type="hidden" name="mode" value="">
|
|
||||||
<input type="hidden" name="id" value="' . $object->id . '">
|
|
||||||
';
|
|
||||||
|
|
||||||
// Show object lines
|
// Show object lines
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
@ -3465,7 +3506,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == 0 && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA|| $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
if ($object->statut == 0 && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
||||||
if ($user->rights->facture->valider) {
|
if ($user->rights->facture->valider) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2609,14 +2609,20 @@ class Facture extends CommonInvoice
|
|||||||
else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre';
|
else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre';
|
||||||
else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure';
|
else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure';
|
||||||
|
|
||||||
|
if (! empty($conf->global->FACTURE_ADDON))
|
||||||
|
{
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
$file = $conf->global->FACTURE_ADDON.".php";
|
$file = $conf->global->FACTURE_ADDON.".php";
|
||||||
$classname = $conf->global->FACTURE_ADDON;
|
$classname = $conf->global->FACTURE_ADDON;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
|
||||||
$dir = $dirroot."/core/modules/facture/";
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/facture/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
@ -2635,7 +2641,6 @@ class Facture extends CommonInvoice
|
|||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print "xx".$mybool.$dir.$file."-".$classname;
|
|
||||||
|
|
||||||
if (! $mybool)
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
@ -2645,7 +2650,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$obj = new $classname();
|
$obj = new $classname();
|
||||||
$numref = "";
|
$numref = "";
|
||||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
$numref = $obj->getNextValue($soc,$this,$mode);
|
||||||
|
|
||||||
if ($numref != "")
|
if ($numref != "")
|
||||||
{
|
{
|
||||||
@ -2653,8 +2658,15 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
|
||||||
return false;
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -553,7 +553,7 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (empty($mode))
|
if (empty($mode))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,17 +71,19 @@ if ($facid > 0)
|
|||||||
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('paiementcard','globalcard'));
|
$hookmanager->initHooks(array('paiementcard','globalcard'));
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
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'));
|
||||||
@ -151,25 +153,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'));
|
||||||
@ -250,6 +252,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -902,7 +902,6 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql.= " ORDER BY ref DESC LIMIT 1";
|
$sql.= " ORDER BY ref DESC LIMIT 1";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||||
dol_syslog(__METHOD__."::Treatments", LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -921,9 +920,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
||||||
@ -946,8 +943,6 @@ class BonPrelevement extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->error(), LOG_ERR);
|
dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->error(), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1045,13 +1040,10 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql.= " WHERE rowid = ".$prev_id;
|
$sql.= " WHERE rowid = ".$prev_id;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog(__METHOD__."::Update total, sql=".$sql, LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
dol_syslog("Erreur mise a jour du total - $sql");
|
|
||||||
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -211,23 +211,31 @@ class Contrat extends CommonObject
|
|||||||
global $db, $langs, $conf;
|
global $db, $langs, $conf;
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/contract";
|
if (!empty($conf->global->CONTRACT_ADDON))
|
||||||
|
|
||||||
if (empty($conf->global->CONTRACT_ADDON))
|
|
||||||
{
|
{
|
||||||
$conf->global->CONTRACT_ADDON='mod_contract_serpis';
|
$mybool = false;
|
||||||
}
|
|
||||||
|
|
||||||
$file = $conf->global->CONTRACT_ADDON.".php";
|
$file = $conf->global->CONTRACT_ADDON.".php";
|
||||||
|
|
||||||
// Chargement de la classe de numerotation
|
|
||||||
$classname = $conf->global->CONTRACT_ADDON;
|
$classname = $conf->global->CONTRACT_ADDON;
|
||||||
|
|
||||||
$result=include_once $dir.'/'.$file;
|
// Include file with class
|
||||||
if ($result)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
|
||||||
$obj = new $classname();
|
|
||||||
|
|
||||||
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/contract/");
|
||||||
|
|
||||||
|
// Load file with numbering class (if found)
|
||||||
|
$mybool|=@include_once $dir.$file;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $mybool)
|
||||||
|
{
|
||||||
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj = new $classname();
|
||||||
$numref = "";
|
$numref = "";
|
||||||
$numref = $obj->getNextValue($soc,$this);
|
$numref = $obj->getNextValue($soc,$this);
|
||||||
|
|
||||||
@ -237,13 +245,15 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error = $obj->error;
|
||||||
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
|
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined");
|
$langs->load("errors");
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendto = $thirdparty->contact_get_property($_POST['receiver'],'email');
|
$sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email');
|
||||||
$sendtoid = $_POST['receiver'];
|
$sendtoid = $_POST['receiver'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
else // Id du contact
|
else // Id du contact
|
||||||
{
|
{
|
||||||
$sendtocc = $thirdparty->contact_get_property($_POST['receivercc'],'email');
|
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class Menubase
|
|||||||
$sql.= " '".$this->fk_menu."',";
|
$sql.= " '".$this->fk_menu."',";
|
||||||
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
|
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
|
||||||
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
|
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
|
||||||
$sql.= " '".$this->position."',";
|
$sql.= " '".(int) $this->position."',";
|
||||||
$sql.= " '".$this->db->escape($this->url)."',";
|
$sql.= " '".$this->db->escape($this->url)."',";
|
||||||
$sql.= " '".$this->db->escape($this->target)."',";
|
$sql.= " '".$this->db->escape($this->target)."',";
|
||||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||||
|
|||||||
@ -2456,19 +2456,22 @@ function dol_print_error($db='',$error='')
|
|||||||
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
|
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
|
||||||
{
|
{
|
||||||
$out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
|
$out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
|
||||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $out.="You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n";
|
||||||
$out.="You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n";
|
|
||||||
$out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
|
$out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
|
||||||
|
|
||||||
$out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";;
|
$out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";
|
||||||
$out.="<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";;
|
$out.="<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";
|
||||||
if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out.="<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";;
|
if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out.="<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";
|
||||||
if (function_exists("phpversion"))
|
if (function_exists("phpversion"))
|
||||||
{
|
{
|
||||||
$out.="<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
|
$out.="<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
|
||||||
//phpinfo(); // This is to show location of php.ini file
|
|
||||||
}
|
}
|
||||||
$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
|
$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
|
||||||
|
if (function_exists("php_uname"))
|
||||||
|
{
|
||||||
|
$out.="<b>".$langs->trans("OS").":</b> ".php_uname()."<br>\n";
|
||||||
|
}
|
||||||
|
$out.="<b>".$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n";
|
||||||
$out.="<br>\n";
|
$out.="<br>\n";
|
||||||
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."<br>\n";
|
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."<br>\n";
|
||||||
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?dol_htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."<br>\n";
|
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?dol_htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."<br>\n";
|
||||||
|
|||||||
@ -344,7 +344,8 @@ abstract class DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the translated module name if translation exists in admin.lang or the default module name.
|
* Gives the translated module name if translation exists in admin.lang or into language files of module.
|
||||||
|
* Otherwise return the module key name.
|
||||||
*
|
*
|
||||||
* @return string Translated module name
|
* @return string Translated module name
|
||||||
*/
|
*/
|
||||||
@ -360,8 +361,15 @@ abstract class DolibarrModules
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If module name translation using it's unique id does not exists, we take its name
|
// If module name translation using it's unique id does not exists, we take use its name to find translation
|
||||||
return $this->name;
|
if (is_array($this->langfiles))
|
||||||
|
{
|
||||||
|
foreach($this->langfiles as $val)
|
||||||
|
{
|
||||||
|
if ($val) $langs->load($val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $langs->trans($this->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,8 +391,15 @@ abstract class DolibarrModules
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If module description translation using it's unique id does not exists, we take its description
|
// If module description translation using it's unique id does not exists, we take use its name to find translation
|
||||||
return $this->description;
|
if (is_array($this->langfiles))
|
||||||
|
{
|
||||||
|
foreach($this->langfiles as $val)
|
||||||
|
{
|
||||||
|
if ($val) $langs->load($val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $langs->trans($this->description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -868,6 +883,8 @@ abstract class DolibarrModules
|
|||||||
|
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
|
if (empty($this->const)) return 0;
|
||||||
|
|
||||||
foreach ($this->const as $key => $value)
|
foreach ($this->const as $key => $value)
|
||||||
{
|
{
|
||||||
$name = $this->const[$key][0];
|
$name = $this->const[$key][0];
|
||||||
@ -935,6 +952,8 @@ abstract class DolibarrModules
|
|||||||
|
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
|
if (empty($this->const)) return 0;
|
||||||
|
|
||||||
foreach ($this->const as $key => $value)
|
foreach ($this->const as $key => $value)
|
||||||
{
|
{
|
||||||
$name = $this->const[$key][0];
|
$name = $this->const[$key][0];
|
||||||
|
|||||||
@ -95,17 +95,17 @@ class modDeplacement extends DolibarrModules
|
|||||||
$this->rights[3][3] = 0;
|
$this->rights[3][3] = 0;
|
||||||
$this->rights[3][4] = 'supprimer';
|
$this->rights[3][4] = 'supprimer';
|
||||||
|
|
||||||
$this->rights[3][0] = 174;
|
$this->rights[4][0] = 174;
|
||||||
$this->rights[3][1] = 'Lire toutes les notes de frais';
|
$this->rights[4][1] = 'Lire toutes les notes de frais';
|
||||||
$this->rights[3][2] = 'd';
|
$this->rights[4][2] = 'd';
|
||||||
$this->rights[3][3] = 0;
|
$this->rights[4][3] = 0;
|
||||||
$this->rights[3][4] = 'readall';
|
$this->rights[4][4] = 'readall';
|
||||||
|
|
||||||
$this->rights[6][0] = 178;
|
$this->rights[5][0] = 178;
|
||||||
$this->rights[6][1] = 'Exporter les notes de frais et deplacements';
|
$this->rights[5][1] = 'Exporter les notes de frais et deplacements';
|
||||||
$this->rights[6][2] = 'd';
|
$this->rights[5][2] = 'd';
|
||||||
$this->rights[6][3] = 0;
|
$this->rights[5][3] = 0;
|
||||||
$this->rights[6][4] = 'export';
|
$this->rights[5][4] = 'export';
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|||||||
@ -125,7 +125,8 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc->code_fournisseur,$object->datef);
|
//Supplier invoices take invoice date instead of creation date for the mask
|
||||||
|
$numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc->code_fournisseur,$object->date);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -353,16 +353,20 @@ if (($action=="create") || ($action=="edit"))
|
|||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
print $langs->trans('CronEvery')."</td>";
|
print $langs->trans('CronEvery')."</td>";
|
||||||
print "<td><select name=\"nbfrequency\">";
|
print "<td><select name=\"nbfrequency\">";
|
||||||
for($i=1; $i<=60; $i++){
|
for($i=1; $i<=60; $i++)
|
||||||
if(($object->frequency/$object->unitfrequency) == $i){
|
{
|
||||||
|
if (! empty($object->unitfrequency) && ($object->frequency/$object->unitfrequency) == $i)
|
||||||
|
{
|
||||||
print "<option value='".$i."' selected='selected'>".$i."</option>";
|
print "<option value='".$i."' selected='selected'>".$i."</option>";
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
print "<option value='".$i."'>".$i."</option>";
|
print "<option value='".$i."'>".$i."</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$input = "<input type=\"radio\" name=\"unitfrequency\" value=\"60\" id=\"frequency_minute\" ";
|
$input = "<input type=\"radio\" name=\"unitfrequency\" value=\"60\" id=\"frequency_minute\" ";
|
||||||
if($object->unitfrequency=="60"){
|
if($object->unitfrequency=="60")
|
||||||
|
{
|
||||||
$input .= ' checked="checked" />';
|
$input .= ' checked="checked" />';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@ -108,8 +108,10 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if ($action == 'add')
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
if ($action == 'add')
|
||||||
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -235,13 +237,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)
|
||||||
{
|
{
|
||||||
@ -252,10 +254,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);
|
||||||
@ -285,10 +287,10 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
|
|||||||
if ($result < 0) dol_print_error($db,$result);
|
if ($result < 0) dol_print_error($db,$result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -300,19 +302,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'));
|
||||||
|
|
||||||
@ -322,16 +324,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'));
|
||||||
@ -359,12 +361,11 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action="";
|
$action="";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build document
|
|
||||||
else if ($action == 'builddoc') // En get ou en post
|
|
||||||
{
|
|
||||||
|
|
||||||
|
// Build document
|
||||||
|
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'));
|
||||||
|
|
||||||
@ -384,11 +385,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";
|
||||||
@ -396,191 +397,24 @@ 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
|
|
||||||
*/
|
|
||||||
if (GETPOST('addfile','alpha'))
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
|
|
||||||
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
|
||||||
$vardir=$conf->user->dir_output."/".$user->id;
|
|
||||||
$upload_dir_tmp = $vardir.'/temp';
|
|
||||||
|
|
||||||
dol_add_file_process($upload_dir_tmp,0,0);
|
|
||||||
$action ='presend';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove file in email form
|
|
||||||
*/
|
|
||||||
if (GETPOST('removedfile','alpha'))
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
|
|
||||||
// Set tmp user directory
|
|
||||||
$vardir=$conf->user->dir_output."/".$user->id;
|
|
||||||
$upload_dir_tmp = $vardir.'/temp';
|
|
||||||
|
|
||||||
// TODO Delete only files that was uploaded from email form
|
|
||||||
dol_remove_file_process(GETPOST('removedfile','int'),0);
|
|
||||||
$action ='presend';
|
|
||||||
}
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send mail
|
|
||||||
*/
|
|
||||||
if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile','alpha') && ! GETPOST('cancel','alpha'))
|
|
||||||
{
|
|
||||||
$langs->load('mails');
|
|
||||||
|
|
||||||
// $ref = dol_sanitizeFileName($object->ref);
|
|
||||||
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
|
||||||
|
|
||||||
// if (is_readable($file))
|
|
||||||
// {
|
|
||||||
if (GETPOST('sendto','alpha'))
|
|
||||||
{
|
|
||||||
// Le destinataire a ete fourni via le champ libre
|
|
||||||
$sendto = GETPOST('sendto','alpha');
|
|
||||||
$sendtoid = 0;
|
|
||||||
}
|
|
||||||
elseif (GETPOST('receiver','alpha') != '-1')
|
|
||||||
{
|
|
||||||
// Recipient was provided from combo list
|
|
||||||
if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party
|
|
||||||
{
|
|
||||||
$sendto = $object->client->email;
|
|
||||||
$sendtoid = 0;
|
|
||||||
}
|
|
||||||
else // Id du contact
|
|
||||||
{
|
|
||||||
$sendto = $object->client->contact_get_property(GETPOST('receiver','alpha'),'email');
|
|
||||||
$sendtoid = GETPOST('receiver','alpha');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dol_strlen($sendto))
|
elseif ($action == 'classifybilled')
|
||||||
{
|
{
|
||||||
$langs->load("commercial");
|
|
||||||
|
|
||||||
$from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>';
|
|
||||||
$replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>';
|
|
||||||
$message = GETPOST('message');
|
|
||||||
$sendtocc = GETPOST('sendtocc','alpha');
|
|
||||||
$deliveryreceipt = GETPOST('deliveryreceipt','alpha');
|
|
||||||
|
|
||||||
if ($action == 'send')
|
|
||||||
{
|
|
||||||
if (dol_strlen(GETPOST('subject','alpha'))) $subject=GETPOST('subject','alpha');
|
|
||||||
else $subject = $langs->transnoentities('Shipping').' '.$object->ref;
|
|
||||||
$actiontypecode='AC_SHIP';
|
|
||||||
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
|
||||||
if ($message)
|
|
||||||
{
|
|
||||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
|
||||||
}
|
|
||||||
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create form object
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
|
|
||||||
$attachedfiles=$formmail->get_attached_files();
|
|
||||||
$filepath = $attachedfiles['paths'];
|
|
||||||
$filename = $attachedfiles['names'];
|
|
||||||
$mimetype = $attachedfiles['mimes'];
|
|
||||||
|
|
||||||
// Send mail
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
|
||||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
|
|
||||||
if ($mailfile->error)
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result=$mailfile->sendfile();
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
// Initialisation donnees
|
|
||||||
$object->sendtoid = $sendtoid;
|
|
||||||
$object->actiontypecode = $actiontypecode;
|
|
||||||
$object->actionmsg = $actionmsg;
|
|
||||||
$object->actionmsg2 = $actionmsg2;
|
|
||||||
$object->fk_element = $object->id;
|
|
||||||
$object->elementtype = $object->element;
|
|
||||||
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($db);
|
|
||||||
$result=$interface->run_triggers('SHIPPING_SENTBYMAIL',$object,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $object->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if ($error)
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Redirect here
|
|
||||||
// This avoid sending mail twice if going out and then back to page
|
|
||||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
|
||||||
setEventMessage($mesg);
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("other");
|
|
||||||
$mesg='<div class="error">';
|
|
||||||
if ($mailfile->error)
|
|
||||||
{
|
|
||||||
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
|
||||||
$mesg.='<br>'.$mailfile->error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
|
||||||
}
|
|
||||||
$mesg.='</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("other");
|
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
|
||||||
$action='presend';
|
|
||||||
dol_syslog('Recipient email is empty');
|
|
||||||
}
|
|
||||||
/* }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
|
||||||
dol_syslog('Failed to read file: '.$file);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ($action == 'classifybilled')
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->set_billed();
|
$object->set_billed();
|
||||||
|
}
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
// Actions to send emails
|
||||||
|
if (empty($id)) $id=$facid;
|
||||||
|
$actiontypecode='AC_SHIP';
|
||||||
|
$trigger_name='SHIPPING_SENTBYMAIL';
|
||||||
|
$paramname='id';
|
||||||
|
$mode='emailfromshipment';
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -121,21 +121,30 @@ class Expedition extends CommonObject
|
|||||||
global $db, $langs, $conf;
|
global $db, $langs, $conf;
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
|
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/expedition";
|
if (!empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||||
|
|
||||||
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
|
||||||
{
|
{
|
||||||
$conf->global->EXPEDITION_ADDON_NUMBER='mod_expedition_safor';
|
$mybool = false;
|
||||||
}
|
|
||||||
|
|
||||||
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
||||||
|
|
||||||
// Chargement de la classe de numerotation
|
|
||||||
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
||||||
|
|
||||||
$result=include_once $dir.'/'.$file;
|
// Include file with class
|
||||||
if ($result)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/expedition/");
|
||||||
|
|
||||||
|
// Load file with numbering class (if found)
|
||||||
|
$mybool|=@include_once $dir.$file;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$obj = new $classname();
|
$obj = new $classname();
|
||||||
$numref = "";
|
$numref = "";
|
||||||
$numref = $obj->getNextValue($soc,$this);
|
$numref = $obj->getNextValue($soc,$this);
|
||||||
|
|||||||
@ -574,25 +574,33 @@ class Fichinter extends CommonObject
|
|||||||
global $conf, $db, $langs;
|
global $conf, $db, $langs;
|
||||||
$langs->load("interventions");
|
$langs->load("interventions");
|
||||||
|
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/fichinter/";
|
|
||||||
|
|
||||||
if (! empty($conf->global->FICHEINTER_ADDON))
|
if (! empty($conf->global->FICHEINTER_ADDON))
|
||||||
{
|
{
|
||||||
$file = $conf->global->FICHEINTER_ADDON.".php";
|
$mybool = false;
|
||||||
$classname = $conf->global->FICHEINTER_ADDON;
|
|
||||||
if (! file_exists($dir.$file))
|
$file = "mod_".$conf->global->FICHEINTER_ADDON.".php";
|
||||||
{
|
$classname = "mod_".$conf->global->FICHEINTER_ADDON;
|
||||||
$file='mod_'.$file;
|
|
||||||
$classname='mod_'.$classname;
|
// Include file with class
|
||||||
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/fichinter/");
|
||||||
|
|
||||||
|
// Load file with numbering class (if found)
|
||||||
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chargement de la classe de numerotation
|
if (! $mybool)
|
||||||
require_once $dir.$file;
|
{
|
||||||
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$obj = new $classname();
|
$obj = new $classname();
|
||||||
|
|
||||||
$numref = "";
|
$numref = "";
|
||||||
$numref = $obj->getNumRef($soc,$this);
|
$numref = $obj->getNextValue($soc,$this);
|
||||||
|
|
||||||
if ( $numref != "")
|
if ( $numref != "")
|
||||||
{
|
{
|
||||||
@ -606,6 +614,7 @@ class Fichinter extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined");
|
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ $langs->load('companies');
|
|||||||
$langs->load('commercial');
|
$langs->load('commercial');
|
||||||
|
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = (GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
$id = (GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
||||||
@ -60,10 +61,14 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if ($action == 'setsupplieraccountancycode')
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
$cancelbutton = GETPOST('cancel');
|
if ($cancelbutton)
|
||||||
if (! $cancelbutton)
|
{
|
||||||
|
$action = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'setsupplieraccountancycode')
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->code_compta_fournisseur=$_POST["supplieraccountancycode"];
|
$object->code_compta_fournisseur=$_POST["supplieraccountancycode"];
|
||||||
@ -73,21 +78,20 @@ if ($action == 'setsupplieraccountancycode')
|
|||||||
$mesg=join(',',$object->errors);
|
$mesg=join(',',$object->errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$action="";
|
// conditions de reglement
|
||||||
}
|
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||||
// conditions de reglement
|
{
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -557,23 +557,32 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
global $db, $langs, $conf;
|
global $db, $langs, $conf;
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
|
|
||||||
$dir = DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/';
|
|
||||||
|
|
||||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER))
|
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER))
|
||||||
{
|
{
|
||||||
|
$mybool = false;
|
||||||
|
|
||||||
$file = $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER.'.php';
|
$file = $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER.'.php';
|
||||||
|
$classname=$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER;
|
||||||
|
|
||||||
if (is_readable($dir.'/'.$file))
|
// Include file with class
|
||||||
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/supplier_order/");
|
||||||
|
|
||||||
|
// Load file with numbering class (if found)
|
||||||
|
$mybool|=@include_once $dir.$file;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $mybool)
|
||||||
{
|
{
|
||||||
// Definition du nom de modele de numerotation de commande fournisseur
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
$modName=$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER;
|
return '';
|
||||||
require_once $dir.'/'.$file;
|
}
|
||||||
|
|
||||||
// Recuperation de la nouvelle reference
|
$obj = new $classname();
|
||||||
$objMod = new $modName($this->db);
|
$numref = $obj->getNextValue($soc,$this);
|
||||||
|
|
||||||
$numref = "";
|
|
||||||
$numref = $objMod->commande_get_num($soc,$this);
|
|
||||||
|
|
||||||
if ( $numref != "")
|
if ( $numref != "")
|
||||||
{
|
{
|
||||||
@ -581,22 +590,17 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error = $obj->error;
|
||||||
dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error);
|
dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER);
|
$this->error = "Error_COMMANDE_SUPPLIER_ADDON_NotDefined";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_NotDefined");
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accept an order
|
* Accept an order
|
||||||
|
|||||||
@ -1514,10 +1514,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
$file = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER.".php";
|
$file = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER.".php";
|
||||||
$classname = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER;
|
$classname = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER;
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
{
|
|
||||||
$dir = $dirroot."/core/modules/supplier_invoice/";
|
foreach ($dirmodels as $reldir) {
|
||||||
|
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
|
||||||
|
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once $dir.$file;
|
$mybool|=@include_once $dir.$file;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -479,14 +479,16 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r
|
|||||||
$result = $object->deleteline(GETPOST('lineid'));
|
$result = $object->deleteline(GETPOST('lineid'));
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$outputlangs = $langs;
|
|
||||||
if (GETPOST('lang_id'))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||||
|
if (! empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
$ret=$object->fetch($object->id); // Reload to get new records
|
$ret=$object->fetch($object->id); // Reload to get new records
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
@ -571,6 +573,14 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||||
|
if (! empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
||||||
|
|||||||
@ -66,17 +66,20 @@ if ($user->societe_id > 0)
|
|||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('paymentsupplier'));
|
$hookmanager->initHooks(array('paymentsupplier'));
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
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'));
|
||||||
@ -146,26 +149,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'));
|
||||||
@ -226,10 +229,10 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -23,6 +23,7 @@ create table llx_contrat
|
|||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
ref varchar(30), -- contrat reference
|
ref varchar(30), -- contrat reference
|
||||||
ref_supplier varchar(30), -- suplier contract ref
|
ref_supplier varchar(30), -- suplier contract ref
|
||||||
|
ref_ext varchar(30), -- external contract ref
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
datec datetime, -- creation date
|
datec datetime, -- creation date
|
||||||
|
|||||||
@ -1038,7 +1038,7 @@ SendingMailSetup=Setup of sendings by email
|
|||||||
SendmailOptionNotComplete=Warning, on some Linux systems, to send email from your email, sendmail execution setup must contains option -ba (parameter mail.force_extra_parameters into your php.ini file). If some recipients never receive emails, try to edit this PHP parameter with mail.force_extra_parameters = -ba).
|
SendmailOptionNotComplete=Warning, on some Linux systems, to send email from your email, sendmail execution setup must contains option -ba (parameter mail.force_extra_parameters into your php.ini file). If some recipients never receive emails, try to edit this PHP parameter with mail.force_extra_parameters = -ba).
|
||||||
PathToDocuments=Path to documents
|
PathToDocuments=Path to documents
|
||||||
PathDirectory=Directory
|
PathDirectory=Directory
|
||||||
SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail direct" will generate a mail message that might be not correctly parsed by some receiving mail servers. Result is that some mails can't be read by people hosted by thoose bugged platforms. It's case for some Internet providers (Ex: Orange in France). This is not a problem into Dolibarr nor into PHP but onto receiving mail server. You can however add option MAIN_FIX_FOR_BUGGED_MTA to 1 into setup - other to modify Dolibarr to avoid this. However, you may experience problem with other servers that respect strictly the SMTP standard. The other solution (recommanded) is to use the method "SMTP socket library" that has no disadvantages.
|
SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail direct" will generate a mail message that might be not correctly parsed by some receiving mail servers. Result is that some mails can't be read by people hosted by those bugged platforms. It's case for some Internet providers (Ex: Orange in France). This is not a problem into Dolibarr nor into PHP but onto receiving mail server. You can however add option MAIN_FIX_FOR_BUGGED_MTA to 1 into setup - other to modify Dolibarr to avoid this. However, you may experience problem with other servers that respect strictly the SMTP standard. The other solution (recommended) is to use the method "SMTP socket library" that has no disadvantages.
|
||||||
TranslationSetup=Configuration de la traduction
|
TranslationSetup=Configuration de la traduction
|
||||||
TranslationDesc=Choice of language visible on screen can be modified:<br>* Globally from menu <strong>Home - Setup - Display</strong><br>* For user only from tab <strong>User display</strong> of user card (click on login on top of screen).
|
TranslationDesc=Choice of language visible on screen can be modified:<br>* Globally from menu <strong>Home - Setup - Display</strong><br>* For user only from tab <strong>User display</strong> of user card (click on login on top of screen).
|
||||||
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b>
|
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b>
|
||||||
@ -1415,7 +1415,7 @@ AdvancedEditor=Advanced editor
|
|||||||
ActivateFCKeditor=Activate advanced editor for:
|
ActivateFCKeditor=Activate advanced editor for:
|
||||||
FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services)
|
FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services)
|
||||||
FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note
|
FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note
|
||||||
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommanded as it can create problems with special characters and page formating when building PDF files.</font>
|
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formating when building PDF files.</font>
|
||||||
FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
|
FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
|
||||||
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature
|
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature
|
||||||
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Outils->eMailing)
|
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Outils->eMailing)
|
||||||
|
|||||||
@ -260,6 +260,7 @@ days=days
|
|||||||
Hours=Hours
|
Hours=Hours
|
||||||
Minutes=Minutes
|
Minutes=Minutes
|
||||||
Seconds=Seconds
|
Seconds=Seconds
|
||||||
|
Weeks=Weeks
|
||||||
Today=Today
|
Today=Today
|
||||||
Yesterday=Yesterday
|
Yesterday=Yesterday
|
||||||
Tomorrow=Tomorrow
|
Tomorrow=Tomorrow
|
||||||
|
|||||||
@ -736,7 +736,7 @@ if ((! empty($conf->browser->layout) && $conf->browser->layout == 'phone')
|
|||||||
// If we force to use jmobile, then we reenable javascript
|
// If we force to use jmobile, then we reenable javascript
|
||||||
if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
|
if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
|
||||||
// Replace themes bugged with jmobile with eldy
|
// Replace themes bugged with jmobile with eldy
|
||||||
if (! empty($conf->dol_use_jmobile) && in_array($conf->theme,array('bureau2crea','cameleo')))
|
if (! empty($conf->dol_use_jmobile) && in_array($conf->theme,array('bureau2crea','cameleo','amarok')))
|
||||||
{
|
{
|
||||||
$conf->theme='eldy';
|
$conf->theme='eldy';
|
||||||
$conf->css = "/theme/".$conf->theme."/style.css.php";
|
$conf->css = "/theme/".$conf->theme."/style.css.php";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,5 +22,15 @@
|
|||||||
* \brief Page d'index du module margin
|
* \brief Page d'index du module margin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require 'productMargins.php';
|
require '../main.inc.php';
|
||||||
|
|
||||||
|
if ($user->rights->produit->lire) {
|
||||||
|
$page = 'productMargins';
|
||||||
|
} elseif ($user->rights->societe->lire) {
|
||||||
|
$page = 'customerMargins';
|
||||||
|
} else {
|
||||||
|
$page = 'agentMargins';
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: '.dol_buildpath('/margin/'.$page.'.php', 1));
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -56,21 +57,25 @@ function marges_admin_prepare_head()
|
|||||||
*/
|
*/
|
||||||
function marges_prepare_head()
|
function marges_prepare_head()
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf, $user;
|
||||||
$langs->load("marges@marges");
|
$langs->load("marges@marges");
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
|
if ($user->rights->produit->lire) {
|
||||||
$head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
|
$head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
|
||||||
$head[$h][1] = $langs->trans("ProductMargins");
|
$head[$h][1] = $langs->trans("ProductMargins");
|
||||||
$head[$h][2] = 'productMargins';
|
$head[$h][2] = 'productMargins';
|
||||||
$h++;
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->societe->lire) {
|
||||||
$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
|
$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
|
||||||
$head[$h][1] = $langs->trans("CustomerMargins");
|
$head[$h][1] = $langs->trans("CustomerMargins");
|
||||||
$head[$h][2] = 'customerMargins';
|
$head[$h][2] = 'customerMargins';
|
||||||
$h++;
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php";
|
$head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php";
|
||||||
$head[$h][1] = $langs->trans("SalesRepresentativeMargins");
|
$head[$h][1] = $langs->trans("SalesRepresentativeMargins");
|
||||||
|
|||||||
@ -73,16 +73,20 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
$modulepart='produit';
|
$modulepart='produit';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
$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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
/*
|
{
|
||||||
* Action envoie fichier
|
// Action sending file
|
||||||
*/
|
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';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -81,8 +81,10 @@ $parameters=array('socid'=>$socid, 'id_prod'=>$id);
|
|||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) 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)
|
||||||
{
|
{
|
||||||
@ -93,10 +95,10 @@ if ($action == 'remove_pf')
|
|||||||
setEventMessage($langs->trans("PriceRemoved"));
|
setEventMessage($langs->trans("PriceRemoved"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
||||||
@ -181,6 +183,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
|||||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr);
|
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr);
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($product->error, 'errors');
|
setEventMessage($product->error, 'errors');
|
||||||
}
|
}
|
||||||
@ -216,17 +219,17 @@ 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
|
||||||
*/
|
*/
|
||||||
@ -398,7 +401,8 @@ if ($id || $ref)
|
|||||||
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.(GETPOST("tva_tx")?vatrate(GETPOST("tva_tx")):($default_vat!=''?vatrate($default_vat):'')).'">';
|
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.(GETPOST("tva_tx")?vatrate(GETPOST("tva_tx")):($default_vat!=''?vatrate($default_vat):'')).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if (! empty($conf->dynamicprices->enabled)) { //Only show price mode and expression selector if module is enabled
|
if (! empty($conf->dynamicprices->enabled)) //Only show price mode and expression selector if module is enabled
|
||||||
|
{
|
||||||
// Price mode selector
|
// Price mode selector
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("PriceMode").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("PriceMode").'</td><td>';
|
||||||
$price_expression = new PriceExpression($db);
|
$price_expression = new PriceExpression($db);
|
||||||
@ -467,7 +471,7 @@ if ($id || $ref)
|
|||||||
|
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -145,12 +145,12 @@ print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||||
print dol_print_date($object->date_start,'day');
|
print dol_print_date($project->date_start,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||||
print dol_print_date($object->date_end,'day');
|
print dol_print_date($project->date_end,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -62,21 +62,20 @@ $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
/*******************************************************************
|
|
||||||
* ACTIONS
|
|
||||||
*
|
|
||||||
* Put here all code to do according to value of "action" parameter
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write )
|
|
||||||
{
|
{
|
||||||
|
/*******************************************************************
|
||||||
|
* ACTIONS
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write )
|
||||||
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (empty($ref))
|
if (empty($ref))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'</div>';
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -96,7 +95,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage('<div class="error">'.$object->error.'</div>');
|
setEventMessage($object->error, 'errors');
|
||||||
$action='edit';
|
$action='edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,9 +110,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write
|
|||||||
{
|
{
|
||||||
$action='edit';
|
$action='edit';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************
|
/***************************************************
|
||||||
* VIEW
|
* VIEW
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
|
# @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
|
||||||
# @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro
|
# @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro
|
||||||
|
|
||||||
#
|
#
|
||||||
|
# Convert an ODT into a PDF using "jodconverter" tool.
|
||||||
|
# Dolibarr variable MAIN_ODT_AS_PDF must be defined to have this script called after ODT generation.
|
||||||
|
# Dolibarr variable MAIN_DOL_SCRIPTS_ROOT must be defined to path of script directories (otherwise dolibarr will try to guess).
|
||||||
|
|
||||||
|
|
||||||
#if [ -f "$1.odt" ]
|
#if [ -f "$1.odt" ]
|
||||||
# then
|
# then
|
||||||
# soffice --invisible --convert-to pdf:writer_pdf_Export --outdir $2 "$1.odt"
|
# soffice --invisible --convert-to pdf:writer_pdf_Export --outdir $2 "$1.odt"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user