NEW Introduce option MAIN_DEFAULT_PAYMENT_TERM_ID to set default payment

term on company level.
This commit is contained in:
Laurent Destailleur 2016-09-14 11:17:44 +02:00
parent 2facdda690
commit 39d47eab18
2 changed files with 8 additions and 5 deletions

View File

@ -1960,7 +1960,7 @@ if ($action == 'create')
if (empty($socid))
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0));
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
@ -1989,7 +1989,7 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
}
if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
if (! empty($conf->use_javascript_ajax))

View File

@ -2757,20 +2757,23 @@ class Form
/**
* Return list of payment modes
*
* @param string $selected Id du type de paiement pre-selectionne
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Nom de la zone select
* @param int $filtertype Not used
* @param int $addempty Add an empty entry
* @return void
*/
function select_conditions_paiements($selected='',$htmlname='condid',$filtertype=-1,$addempty=0)
function select_conditions_paiements($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0)
{
global $langs,$user;
global $langs, $user, $conf;
dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
$this->load_cache_conditions_paiements();
// Set default value if not already set by caller
if (empty($selected) && ! empty($conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) $selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
print '<select class="flat" name="'.$htmlname.'">';
if ($addempty) print '<option value="0">&nbsp;</option>';
foreach($this->cache_conditions_paiements as $id => $arrayconditions)