Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
68711184b3
@ -188,7 +188,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
|
||||
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
|
||||
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
|
||||
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
@ -262,7 +262,7 @@ $tabfield[21]= "code,label";
|
||||
$tabfield[22]= "code,label";
|
||||
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[24]= "code,label";
|
||||
$tabfield[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
|
||||
$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27]= "code,libelle";
|
||||
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
|
||||
@ -299,7 +299,7 @@ $tabfieldvalue[21]= "code,label";
|
||||
$tabfieldvalue[22]= "code,label";
|
||||
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[24]= "code,label";
|
||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
|
||||
$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27]= "code,libelle";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
|
||||
@ -336,7 +336,7 @@ $tabfieldinsert[21]= "code,label";
|
||||
$tabfieldinsert[22]= "code,label";
|
||||
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[24]= "code,label";
|
||||
$tabfieldinsert[25]= "label,type_template,private,position,topic,content,entity";
|
||||
$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
|
||||
$tabfieldinsert[26]= "code,label,short_label";
|
||||
$tabfieldinsert[27]= "code,libelle";
|
||||
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
|
||||
@ -449,7 +449,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[23] = array();
|
||||
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
||||
@ -1063,6 +1063,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
|
||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
@ -1254,6 +1255,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
|
||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
@ -1771,6 +1773,24 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content_lines')))
|
||||
{
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
||||
}
|
||||
else print '<td>';
|
||||
if ($context != 'hide')
|
||||
{
|
||||
//print '<input type="text" size="100" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
$okforextended=true;
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 100, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_1, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content')))
|
||||
{
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
|
||||
@ -1783,7 +1803,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended=true;
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else print ' ';
|
||||
|
||||
@ -183,20 +183,19 @@ print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
||||
|
||||
/* TODO uncomment when the functionality will integrated
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnInvoiceDate").'</td>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnDocumentDate").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_USE_RATE_ON_INVOICE_DATE">';
|
||||
print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_INVOICE_DATE",$conf->global->MULTICURRENCY_USE_RATE_ON_INVOICE_DATE,1);
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE">';
|
||||
print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE",$conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -218,10 +218,10 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
|
||||
@ -824,7 +824,7 @@ class Propal extends CommonObject
|
||||
if (empty($this->demand_reason_id)) $this->demand_reason_id=0;
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
||||
if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||
if (empty($this->fk_multicurrency))
|
||||
{
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
|
||||
@ -704,9 +704,12 @@ class Commande extends CommonOrder
|
||||
|
||||
// Clean parameters
|
||||
$this->brouillon = 1; // set command as draft
|
||||
|
||||
|
||||
// $date_commande is deprecated
|
||||
$date = ($this->date_commande ? $this->date_commande : $this->date);
|
||||
|
||||
// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
|
||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date);
|
||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
if (empty($this->fk_multicurrency))
|
||||
{
|
||||
@ -745,9 +748,6 @@ class Commande extends CommonOrder
|
||||
return -1;
|
||||
}
|
||||
|
||||
// $date_commande is deprecated
|
||||
$date = ($this->date_commande ? $this->date_commande : $this->date);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -77,6 +77,7 @@ class FormMail extends Form
|
||||
var $withfckeditor;
|
||||
|
||||
var $substit=array();
|
||||
var $substit_lines=array();
|
||||
var $param=array();
|
||||
|
||||
var $error;
|
||||
@ -712,6 +713,18 @@ class FormMail extends Form
|
||||
$this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
|
||||
}
|
||||
}
|
||||
|
||||
//Add lines substitution key from each line
|
||||
$lines = '';
|
||||
$defaultlines = $arraydefaultmessage['content_lines'];
|
||||
if (isset($defaultlines))
|
||||
{
|
||||
foreach ($this->substit_lines as $substit_line)
|
||||
{
|
||||
$lines .= make_substitutions($defaultlines,$substit_line)."\n";
|
||||
}
|
||||
}
|
||||
$this->substit['__LINES__']=$lines;
|
||||
|
||||
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||
|
||||
@ -820,7 +833,7 @@ class FormMail extends Form
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT label, topic, content, lang";
|
||||
$sql = "SELECT label, topic, content, content_lines, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity("c_email_templates").")";
|
||||
@ -840,6 +853,7 @@ class FormMail extends Form
|
||||
$ret['label']=$obj->label;
|
||||
$ret['topic']=$obj->topic;
|
||||
$ret['content']=$obj->content;
|
||||
$ret['content_lines']=$obj->content_lines;
|
||||
$ret['lang']=$obj->lang;
|
||||
}
|
||||
else
|
||||
@ -859,6 +873,7 @@ class FormMail extends Form
|
||||
$ret['label']='default';
|
||||
$ret['topic']='';
|
||||
$ret['content']=$defaultmessage;
|
||||
$ret['content_lines']='';
|
||||
$ret['lang']=$outputlangs->defaultlang;
|
||||
}
|
||||
|
||||
@ -922,7 +937,7 @@ class FormMail extends Form
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT rowid, label, topic, content, lang, position";
|
||||
$sql = "SELECT rowid, label, topic, content, content_lines, lang, position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity("c_email_templates").")";
|
||||
@ -944,6 +959,7 @@ class FormMail extends Form
|
||||
$line->label=$obj->label;
|
||||
$line->topic=$obj->topic;
|
||||
$line->content=$obj->content;
|
||||
$line->content_lines=$obj->content_lines;
|
||||
$line->lang=$obj->lang;
|
||||
$this->lines_model[]=$line;
|
||||
}
|
||||
@ -962,7 +978,7 @@ class FormMail extends Form
|
||||
/**
|
||||
* Set substit array from object
|
||||
*
|
||||
* @param Object $object Object to use
|
||||
* @param CommonObject $object Object to use
|
||||
* @param Translate $outputlangs Object lang
|
||||
* @return void
|
||||
*/
|
||||
@ -970,11 +986,11 @@ class FormMail extends Form
|
||||
{
|
||||
global $user;
|
||||
$this->substit['__REF__'] = $object->ref;
|
||||
$this->substit['__REFCLIENT__'] = $object->ref_client;
|
||||
$this->substit['__REFSUPPLIER__'] = $object->ref_supplier;
|
||||
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : '';
|
||||
$this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : '';
|
||||
|
||||
$this->substit['__DATE_YMD__'] = dol_print_date($object->date, 'day', 0, $outputlangs);
|
||||
$this->substit['__DATE_DUE_YMD__'] = dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs);
|
||||
$this->substit['__DATE_YMD__'] = isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '';
|
||||
$this->substit['__DATE_DUE_YMD__'] = isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : '';
|
||||
$this->substit['__AMOUNT__'] = price($object->total_ttc);
|
||||
$this->substit['__AMOUNT_WO_TAX__'] = price($object->total_ht);
|
||||
|
||||
@ -988,6 +1004,42 @@ class FormMail extends Form
|
||||
$this->substit['__SIGNATURE__'] = $user->signature;
|
||||
$this->substit['__PERSONALIZED__'] = '';
|
||||
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
|
||||
|
||||
//Fill substit_lines with each object lines content
|
||||
if (is_array($object->lines))
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$substit_line = array(
|
||||
'__PRODUCT_REF__' => isset($line->product_ref) ? $line->product_ref : '',
|
||||
'__PRODUCT_LABEL__' => isset($line->product_label) ? $line->product_label : '',
|
||||
'__PRODUCT_DESCRIPTION__' => isset($line->product_desc) ? $line->product_desc : '',
|
||||
'__LABEL__' => isset($line->label) ? $line->label : '',
|
||||
'__DESCRIPTION__' => isset($line->desc) ? $line->desc : '',
|
||||
'__DATE_START_YMD__' => dol_print_date($line->date_start, 'day', 0, $outputlangs),
|
||||
'__DATE_END_YMD__' => dol_print_date($line->date_end, 'day', 0, $outputlangs),
|
||||
'__QUANTITY__' => $line->qty,
|
||||
'__SUBPRICE__' => price($line->subprice),
|
||||
'__AMOUNT__' => price($line->total_ttc),
|
||||
'__AMOUNT_WO_TAX__' => price($line->total_ht),
|
||||
//'__PRODUCT_EXTRAFIELD_FIELD__' Done dinamically
|
||||
);
|
||||
|
||||
// Create dinamic tags for __PRODUCT_EXTRAFIELD_FIELD__
|
||||
if (!empty($line->fk_product))
|
||||
{
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
|
||||
$product = new Product($this->db);
|
||||
$product->fetch($line->fk_product, '', '', 1);
|
||||
$product->fetch_optionals($product->id, $extralabels);
|
||||
foreach ($extrafields->attribute_label as $key => $label) {
|
||||
$substit_line['__PRODUCT_EXTRAFIELD_' . strtoupper($key) . '__'] = $product->array_options['options_' . $key];
|
||||
}
|
||||
}
|
||||
$this->substit_lines[] = $substit_line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1066,5 +1118,6 @@ class ModelMail
|
||||
public $label;
|
||||
public $topic;
|
||||
public $content;
|
||||
public $content_lines;
|
||||
public $lang;
|
||||
}
|
||||
|
||||
@ -321,9 +321,20 @@ if (empty($reshook))
|
||||
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
||||
else setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
||||
}
|
||||
|
||||
$object->fetch($id);
|
||||
|
||||
$object->date=$newdate;
|
||||
if ($object->date_echeance && $object->date_echeance < $object->date) $object->date_echeance=$object->date;
|
||||
$date_echence_calc=$object->calculate_date_lim_reglement();
|
||||
if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc)
|
||||
{
|
||||
$object->date_echeance = $date_echence_calc;
|
||||
}
|
||||
if ($object->date_echeance && $object->date_echeance < $object->date)
|
||||
{
|
||||
$object->date_echeance=$object->date;
|
||||
}
|
||||
|
||||
$result=$object->update($user);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
@ -1001,7 +1012,7 @@ if (empty($reshook))
|
||||
}
|
||||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
|
||||
|
||||
$result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise);
|
||||
}
|
||||
|
||||
@ -1500,7 +1511,7 @@ if ($action == 'create')
|
||||
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
|
||||
{
|
||||
// Deposit
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
@ -1530,12 +1541,12 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* Not yet supporter for supplier
|
||||
if ($societe->id > 0)
|
||||
{
|
||||
// Replacement
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
{
|
||||
print '<!-- replacement line -->';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
@ -1585,7 +1596,7 @@ if ($action == 'create')
|
||||
if ($societe->id > 0)
|
||||
{
|
||||
// Credit note
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
@ -1621,12 +1632,12 @@ if ($action == 'create')
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
@ -2014,7 +2025,7 @@ else
|
||||
|
||||
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -2183,7 +2194,7 @@ else
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
@ -2210,9 +2221,9 @@ else
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
@ -2226,12 +2237,12 @@ else
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td>' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td>' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
@ -2269,7 +2280,7 @@ else
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
/*
|
||||
* List of payments
|
||||
*/
|
||||
@ -2368,9 +2379,9 @@ else
|
||||
{
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('AlreadyPaid').' :</td><td align="right">'.price($totalpaye).'</td><td></td></tr>';
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("Billed").' :</td><td align="right">'.price($object->total_ttc).'</td><td></td></tr>';
|
||||
|
||||
|
||||
$resteapayer = $object->total_ttc - $totalpaye;
|
||||
|
||||
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans('RemainderToPay').' :</td>';
|
||||
print '<td align="right"'.($resteapayer?' class="amountremaintopay"':'').'>'.price($resteapayer).'</td><td></td></tr>';
|
||||
}
|
||||
@ -2482,7 +2493,7 @@ else
|
||||
print ' :</td>';
|
||||
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':$cssforamountpaymentcomplete).'>' . price($resteapayeraffiche) . '</td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
}
|
||||
}
|
||||
else // Credit note
|
||||
{
|
||||
// Total already paid back
|
||||
@ -2514,9 +2525,9 @@ else
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$blocname = 'contacts';
|
||||
|
||||
@ -43,6 +43,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30);
|
||||
|
||||
ALTER TABLE llx_c_email_templates ADD COLUMN content_lines text;
|
||||
|
||||
ALTER TABLE llx_loan ADD COLUMN fk_projet integer DEFAULT NULL;
|
||||
|
||||
|
||||
@ -32,5 +32,6 @@ create table llx_c_email_templates
|
||||
position smallint, -- Position
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
topic text, -- Predefined topic
|
||||
content text -- Predefined text
|
||||
content text, -- Predefined text
|
||||
content_lines text -- Predefined lines
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -508,22 +508,37 @@ class MultiCurrency extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db object db
|
||||
* @param string $code code value search
|
||||
* @param date $date_document date from document (propal, order, invoice, ...)
|
||||
*
|
||||
* @return array [0] => id currency
|
||||
* [1] => rate
|
||||
*/
|
||||
public static function getIdAndTxFromCode(&$db, $code)
|
||||
public static function getIdAndTxFromCode(&$db, $code, $date_document='')
|
||||
{
|
||||
$sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
|
||||
$sql.= ' WHERE m.code = \''.$db->escape($code).'\'';
|
||||
$sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")";
|
||||
$sql.= ' ORDER BY mc.date_sync DESC LIMIT 1';
|
||||
global $conf;
|
||||
|
||||
$sql1 = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m';
|
||||
$sql1.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
|
||||
$sql1.= ' WHERE m.code = \''.$db->escape($code).'\'';
|
||||
$sql1.= " AND m.entity IN (".getEntity('multicurrency', 1).")";
|
||||
$sql2= '';
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"';
|
||||
$sql3.= ' ORDER BY mc.date_sync DESC LIMIT 1';
|
||||
|
||||
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
$resql = $db->query($sql1.$sql2.$sql3);
|
||||
|
||||
if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate);
|
||||
else return array(0, 1);
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE))
|
||||
{
|
||||
$resql = $db->query($sql1.$sql3);
|
||||
if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate);
|
||||
}
|
||||
|
||||
return array(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user