2
0
forked from Wavyzz/dolibarr

Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/comm/propal/list.php
	htdocs/core/class/html.form.class.php
	htdocs/core/lib/ajax.lib.php
	htdocs/core/tpl/objectline_create.tpl.php
	htdocs/product/fournisseurs.php
This commit is contained in:
Laurent Destailleur
2021-02-15 13:12:27 +01:00
53 changed files with 257 additions and 166 deletions

View File

@@ -72,6 +72,9 @@ FIX: User creation of expense report not visible
FIX: warning when adding a line if $remise_percent is an empty string
FIX: status late on purchase orders
FIX: ODT generation very slow
FIX: amount in summary of report
FIX: vat value when code contains number
FIX: payment term label on PDF
***** ChangeLog for 13.0.0 compared to 12.0.0 *****

View File

@@ -116,6 +116,11 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'p.ref';
if (!$sortorder) $sortorder = 'DESC';
$permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->write;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
// Security check
$module = 'propal';
$dbtable = '';
@@ -260,13 +265,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
if ($object_statut != '') $search_status = $object_statut;
if (empty($reshook))
{
$objectclass = 'Propal';
$objectlabel = 'Proposals';
$permissiontoread = $user->rights->propal->lire;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
$uploaddir = $conf->propal->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -1492,7 +1495,7 @@ if ($resql)
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
} else {
dol_print_error($db);
dol_print_error($db);
}
// End of page

View File

@@ -3283,6 +3283,7 @@ class Commande extends CommonOrder
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
// Check parameters
// Put here code to add control on parameters values
@@ -3307,6 +3308,8 @@ class Commande extends CommonOrder
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
$sql .= " date_livraison=".(strval($this->delivery_date) != '' ? "'".$this->db->idate($this->delivery_date)."'" : 'null').",";
$sql .= " fk_shipping_method=".(isset($this->shipping_method_id) ? $this->shipping_method_id : "null").",";
$sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").",";
$sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";

View File

@@ -585,7 +585,7 @@ foreach ($accounts as $key=>$type)
if (!empty($arrayfields['balance']['checked']))
{
print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance';

View File

@@ -58,6 +58,10 @@ $search_accountancy_account = GETPOST("search_accountancy_account");
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = '';
if (empty($search_datep_start)) $search_datep_start = GETPOST("search_datep_start", 'int');
if (empty($search_datep_end)) $search_datep_end = GETPOST("search_datep_end", 'int');
if (empty($search_datev_start)) $search_datev_start = GETPOST("search_datev_start", 'int');
if (empty($search_datev_end)) $search_datev_end = GETPOST("search_datev_end", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');

View File

@@ -252,7 +252,7 @@ if ($modecompta == 'BOOKKEEPING')
$sql .= " AND f.entity = ".$conf->entity;
if (!empty($date_start) && !empty($date_end))
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
$sql .= " GROUP BY pcg_type, name, socid";
$sql .= " GROUP BY pcg_type DESC, name, socid";
$sql .= $db->order($sortfield, $sortorder);
$oldpcgtype = '';
@@ -284,6 +284,15 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht += (isset($objp->amount) ? $objp->amount : 0);
$total_ttc += (isset($objp->amount) ? $objp->amount : 0);
if ($objp->pcg_type == 'INCOME') {
$total_ht_income += (isset($objp->amount) ? $objp->amount : 0);
$total_ttc_income += (isset($objp->amount) ? $objp->amount : 0);
}
if ($objp->pcg_type == 'EXPENSE') {
$total_ht_outcome -= (isset($objp->amount) ? $objp->amount : 0);
$total_ttc_outcome -= (isset($objp->amount) ? $objp->amount : 0);
}
// Loop on detail of all accounts
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail != 'no')
@@ -446,6 +455,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_income += $total_ht;
$total_ttc_income += $total_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($total_ht).'</td>';
@@ -525,11 +535,12 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_income += $subtotal_ht;
$total_ttc_income += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
}
/*
@@ -609,6 +620,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@@ -686,6 +698,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@@ -764,6 +777,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@@ -841,6 +855,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@@ -926,6 +941,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
@@ -963,6 +979,7 @@ if ($modecompta == 'BOOKKEEPING')
{
$subtotal_ht += -$obj->amount;
$subtotal_ttc += -$obj->amount;
$total_ht_outcome += $obj->amount;
$total_ttc_outcome += $obj->amount;
}
@@ -978,6 +995,7 @@ if ($modecompta == 'BOOKKEEPING')
{
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;
$total_ht_income += $obj->amount;
$total_ttc_income += $obj->amount;
}
@@ -1038,8 +1056,10 @@ if ($modecompta == 'BOOKKEEPING')
}
$total_ht += $subtotal_ht;
$total_ttc += $subtotal_ttc;
$total_ht_income += $subtotal_ht;
$total_ttc_income += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
@@ -1101,8 +1121,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_outcome -= 0;
$total_ttc_outcome -= $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATToPay")."</td>\n";
print '<td class="right">&nbsp;</td>'."\n";
@@ -1151,6 +1173,7 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_income += 0;
$total_ttc_income += $amount;
@@ -1197,8 +1220,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_outcome -= 0;
$total_ttc_outcome -= $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATPaid")."</td>\n";
if ($modecompta == 'CREANCES-DETTES')
@@ -1243,8 +1268,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_income += 0;
$total_ttc_income += $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATCollected")."</td>\n";
if ($modecompta == 'CREANCES-DETTES')
@@ -1279,19 +1306,22 @@ print '<tr>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES')
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
if ($modecompta == 'CREANCES-DETTES')
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
if ($modecompta == 'CREANCES-DETTES')
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
print '</tr>';

View File

@@ -866,9 +866,9 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
if ($obj->pcg_type == 'INCOME') {
if (!isset($encaiss[$obj->dm])) $encaiss[$obj->dm] = 0; // To avoid warning of var not defined
$encaiss[$obj->dm] += $obj->credit;
$encaiss[$obj->dm] -= $obj->credit;
$encaiss[$obj->dm] -= $obj->debit;
}
if ($obj->pcg_type == 'INCOME') {
if ($obj->pcg_type == 'EXPENSE') {
if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0; // To avoid warning of var not defined
$decaiss[$obj->dm] += $obj->debit;
$decaiss[$obj->dm] -= $obj->credit;

View File

@@ -889,8 +889,8 @@ if (empty($reshook))
$action = 'editref';
} else {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$old_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$old_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$files = dol_dir_list($old_filedir);
if (!empty($files))
@@ -935,7 +935,7 @@ if (empty($reshook))
// Actions to build doc
$upload_dir = $conf->contrat->dir_output;
$upload_dir = $conf->contrat->multidir_output[$object->entity];
$permissiontoadd = $user->rights->contrat->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@@ -2137,13 +2137,13 @@ if ($action == 'create')
* Documents generes
*/
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->contrat->lire;
$delallowed = $user->rights->contrat->creer;
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
// Show links to link elements
@@ -2168,7 +2168,7 @@ if ($action == 'create')
// Presend form
$modelmail = 'contract';
$defaulttopic = 'SendContractRef';
$diroutput = $conf->contrat->dir_output;
$diroutput = $conf->contrat->multidir_output[$object->entity];
$trackid = 'con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@@ -1296,7 +1296,7 @@ class Contrat extends CommonObject
$ref = dol_sanitizeFileName($this->ref);
if ($conf->contrat->dir_output)
{
$dir = $conf->contrat->dir_output."/".$ref;
$dir = $conf->contrat->multidir_output[$this->entity]."/".$ref;
if (file_exists($dir))
{
$res = @dol_delete_dir_recursive($dir);

View File

@@ -74,7 +74,7 @@ if ($object->id > 0)
$object->fetch_thirdparty();
}
$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$modulepart = 'contract';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@@ -204,7 +204,7 @@ $formcompany = new FormCompany($db);
$contracttmp = new Contrat($db);
$sql = 'SELECT';
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@@ -260,7 +260,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,';
$sql .= " typent.code,";
$sql .= " state.code_departement, state.nom";
@@ -644,7 +644,7 @@ while ($i < min($num, $limit))
}
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';

View File

@@ -1097,6 +1097,7 @@ if ($action == 'remove_file')
$action = '';
}
// Validate records
if (!$error && $massaction == 'validate' && $permissiontoadd)
{

View File

@@ -135,7 +135,7 @@ class box_comptes extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"',
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
'text' => price($solde, 0, $langs, 1, -1, -1, $objp->currency_code)
);
$line++;

View File

@@ -839,7 +839,7 @@ class ExtraFields
$array_name_label = array();
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,printable,totalizable,fielddefault,fieldcomputed,entity,enabled,help";
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help";
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
if ($elementtype) $sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'"; // Filed with object->table_element

View File

@@ -3109,12 +3109,12 @@ class Form
'value'=>$outref,
'label'=>$outval,
'qty'=>$outqty,
'up'=>$objp->unitprice,
'price_ht'=>price2num($objp->unitprice, 'MT'),
'discount'=>$outdiscount,
'type'=>$outtype,
'duration_value'=>$outdurationvalue,
'duration_unit'=>$outdurationunit,
'disabled'=>(empty($objp->idprodfournprice) ?true:false),
'disabled'=>(empty($objp->idprodfournprice) ? true : false),
'description'=>$objp->description
)
);

View File

@@ -113,7 +113,12 @@ class Translate
} else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
} else { // If it's for a codetouse that is a short code xx
// Array to convert short lang code into long code.
$longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO');
$longforshort = array(
'am'=>'am_ET', 'ar'=>'ar_SA', 'bn'=>'bn_DB', 'el'=>'el_GR', 'ca'=>'ca_ES', 'cs'=>'cs_CZ', 'en'=>'en_US', 'fa'=>'fa_IR',
'gl'=>'gl_ES', 'he'=>'he_IL', 'hi'=>'hi_IN', 'ja'=>'ja_JP',
'ka'=>'ka_GE', 'km'=>'km_KH', 'kn'=>'kn_IN', 'ko'=>'ko_KR', 'lo'=>'lo_LA', 'nb'=>'nb_NO', 'no'=>'nb_NO', 'ne'=>'ne_NP',
'sl'=>'sl_SI', 'sq'=>'sq_AL', 'sr'=>'sr_RS', 'sv'=>'sv_SE', 'uk'=>'uk_UA', 'vi'=>'vi_VN', 'zh'=>'zh_CN'
);
if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])];
elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
else $srclang = 'en_US';

View File

@@ -137,9 +137,10 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
update: update, textarea: textarea,
pbq: item.pbq,
type: item.type, qty: item.qty, discount: item.discount,
pricebasetype: item.pricebasetype, price_ht: item.price_ht,
pricebasetype: item.pricebasetype,
price_ht: item.price_ht,
price_ttc: item.price_ttc,
up: item.up, description : item.description,
description : item.description,
ref_customer: item.ref_customer }
}));
}
@@ -152,32 +153,24 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'");
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
console.log("Propagate before some properties");
console.log("Propagate before some properties retrieved by ajax into data-xxx properties");
//console.log(ui.item);
//For supplier price
$("#'.$htmlname.'").attr("data-up", ui.item.up);
$("#'.$htmlname.'").attr("data-discount", ui.item.discount);
// For supplier price and customer when price by quantity is off
$("#'.$htmlname.'").attr("data-up", ui.item.price_ht);
$("#'.$htmlname.'").attr("data-base", ui.item.pricebasetype);
$("#'.$htmlname.'").attr("data-qty", ui.item.qty);
$("#'.$htmlname.'").attr("data-discount", ui.item.discount);
$("#'.$htmlname.'").attr("data-description", ui.item.description);
$("#'.$htmlname.'").attr("data-ref-customer", ui.item.ref_customer);
//For customer price
';
';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= '
$("#' . $htmlname . '").attr("data-pbq", ui.item.pbq);
$("#' . $htmlname . '").attr("data-pbqup", ui.item.price_ht);
$("#' . $htmlname . '").attr("data-pbqbase", ui.item.pricebasetype);
$("#' . $htmlname . '").attr("data-pbqqty", ui.item.qty);
$("#' . $htmlname . '").attr("data-pbqpercent", ui.item.discount);
';
} else {
$script .= '
$("#' . $htmlname . '").attr("data-up", ui.item.price_ht);
$("#' . $htmlname . '").attr("data-base", ui.item.pricebasetype);
$("#' . $htmlname . '").attr("data-qty", ui.item.qty);
$("#' . $htmlname . '").attr("data-discount", ui.item.discount);
// For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on
$("#'.$htmlname.'").attr("data-pbq", ui.item.pbq);
$("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht);
$("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype);
$("#'.$htmlname.'").attr("data-pbqqty", ui.item.qty);
$("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount);
';
}
$script .= '
@@ -217,6 +210,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
console.log("Make action update on each ui.item.update")
// loop on each "update" fields
$.each(ui.item.update, function(key, value) {
console.log("Set value "+value+" into #"+key);
$("#" + key).val(value).trigger("change");
});
}

View File

@@ -70,7 +70,7 @@ function contract_prepare_head(Contrat $object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$upload_dir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;

View File

@@ -2316,10 +2316,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->ficheinter->{$lire}) $accessallowed = 1;
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
} // Wrapping pour les apercu conat
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output))
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity]))
{
if ($fuser->rights->contrat->{$lire}) $accessallowed = 1;
$original_file = $conf->contrat->dir_output.'/'.$original_file;
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
} // Wrapping pour les apercu supplier proposal
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
{
@@ -2709,13 +2709,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
if (!empty($conf->stock->enabled)) $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file;
} // Wrapping pour les contrats
elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity]))
{
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed = 1;
}
$original_file = $conf->contrat->dir_output.'/'.$original_file;
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")";
} // Wrapping pour les dons
elseif ($modulepart == 'donation' && !empty($conf->don->dir_output))

View File

@@ -590,9 +590,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " WHERE dbt.rowid IN (".$objectid.")";
$sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid;
} elseif (!empty($conf->societe->enabled)) {
} elseif (!empty($conf->societe->enabled) && !$user->rights->societe->client->voir) {
// If internal user: Check permission for internal users that are restricted on their objects
if ($feature != 'ticket' && !$user->rights->societe->client->voir) {
if ($feature != 'ticket') {
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
@@ -601,9 +601,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
$sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield;
$sql .= " AND sc.fk_user = ".$user->id;
}
// On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties.
if ($feature == 'ticket' && !$user->rights->societe->client->voir) {
} else {
// On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties.
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = dbt.".$dbt_keyfield." AND sc.fk_user = ".$user->id;

View File

@@ -712,7 +712,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -930,7 +930,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -219,7 +219,7 @@ class doc_generic_contract_odt extends ModelePDFContract
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->contrat->dir_output)
if ($conf->contrat->multidir_output[$object->entity])
{
// If $object is id instead of object
if (!is_object($object))
@@ -236,7 +236,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$object->fetch_thirdparty();
$dir = $conf->contrat->dir_output;
$dir = $conf->contrat->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
$file = $dir."/".$objectref.".odt";

View File

@@ -201,7 +201,7 @@ class pdf_strato extends ModelePDFContract
$file = $dir."/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->contrat->dir_output."/".$objectref;
$dir = $conf->contrat->multidir_output[$object->entity]."/".$objectref;
$file = $dir."/".$objectref.".pdf";
}

View File

@@ -1004,7 +1004,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -1108,7 +1108,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -908,7 +908,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -1048,7 +1048,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -865,7 +865,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -747,7 +747,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_id);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -807,7 +807,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');

View File

@@ -169,6 +169,7 @@ $totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname];
$help = $extrafields->attributes[$elementtype]['help'][$attrname];
$entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname];
$printable = $extrafields->attributes[$elementtype]['printable'][$attrname];
$enabled = $extrafields->attributes[$elementtype]['enabled'][$attrname];
if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{
@@ -302,6 +303,14 @@ if (in_array($type, array_keys($typewecanchangeinto)))
<!-- Multicompany entity -->
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr>
<?php } ?>
<!-- Show Enabled property when value is not a common value -->
<?php if ($enabled != '1') { ?>
<tr class="help"><td><?php echo $langs->trans("EnabledCondition"); ?></td><td class="valeur">
<?php echo dol_escape_htmltag($enabled); ?>
<?php } ?>
</td></tr>
</table>
<?php print dol_get_fiche_end(); ?>

View File

@@ -76,6 +76,11 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
{
foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value)
{
/*if (! dol_eval($extrafields->attributes[$elementtype]['enabled'][$key], 1)) {
// TODO Uncomment this to exclude extrafields of modules not enabled. Add a link to "Show extrafields disabled"
// continue;
}*/
// Load language if required
if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);

View File

@@ -1,6 +1,6 @@
<?php
print '<!-- extrafields_list_array_fields.tpl.php -->'."\n";
// This tpl file is included into the init part of pages, so before action.
// So no output must be done.
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf))

View File

@@ -32,6 +32,7 @@
* $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error: this template page cannot be called directly as an URL";
@@ -239,18 +240,18 @@ if ($nolinesbefore) {
<?php
}
} else {
// $senderissupplier=2 is the same as 1 but disables test on minimum qty and disable autofill qty with minimum
// $senderissupplier=2 is the same as 1 but disables test on minimum qty, disable autofill qty with minimum and autofill unit price
if ($senderissupplier != 2)
{
$ajaxoptions = array(
'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
);
$alsoproductwithnosupplierprice = 0;
} else {
$ajaxoptions = array(
'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key
'update' => array('remise_percent' => 'discount', 'price_ht' => 'price_ht') // html id tags that will be edited with each ajax json response key
);
$alsoproductwithnosupplierprice = 1;
}
@@ -535,47 +536,47 @@ if (!empty($usemargins) && $user->rights->margins->creer)
/* TODO This does not work for number with thousand separator that is , */
function checkFreeLine(e, npRate)
{
var buying_price = $("input[name='buying_price']:first");
var remise = $("input[name='remise_percent']:first");
var buying_price = $("input[name='buying_price']:first");
var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
if (! $.isNumeric(rate.val().replace(',','.')))
{
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
if (npRate == "np_markRate" && rate.val() >= 100)
{
alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
var price = 0;
remisejs=price2numjs(remise.val());
if (remisejs != 100) // If a discount not 100 or no discount
{
if (remisejs == '') remisejs=0;
bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val());
if (npRate == "np_marginRate")
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
}
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
if (! $.isNumeric(rate.val().replace(',','.')))
{
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
if (npRate == "np_markRate" && rate.val() >= 100)
{
alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
var price = 0;
remisejs=price2numjs(remise.val());
if (remisejs != 100) // If a discount not 100 or no discount
{
if (remisejs == '') remisejs=0;
bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val());
if (npRate == "np_marginRate")
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
}
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
return true;
}
<?php
@@ -612,28 +613,28 @@ if (!empty($usemargins) && $user->rights->margins->creer)
$("#select_type").change(function()
{
setforfree();
if (jQuery('#select_type').val() >= 0)
{
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
jQuery('#dp_desc').focus();
/* focus if CKEDITOR */
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
if (jQuery('#select_type').val() >= 0)
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) { editor.focus(); }
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
jQuery('#dp_desc').focus();
/* focus if CKEDITOR */
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) { editor.focus(); }
}
}
console.log("Hide/show date according to product type");
if (jQuery('#select_type').val() == '0')
{
jQuery('#trlinefordates').hide();
jQuery('.divlinefordates').hide();
}
else
{
jQuery('#trlinefordates').show();
jQuery('.divlinefordates').show();
}
}
console.log("Hide/show date according to product type");
if (jQuery('#select_type').val() == '0')
{
jQuery('#trlinefordates').hide();
jQuery('.divlinefordates').hide();
}
else
{
jQuery('#trlinefordates').show();
jQuery('.divlinefordates').show();
}
});
$("#prod_entry_mode_predef").on( "click", function() {
@@ -652,7 +653,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()
{
console.log("Call method change() after change on #idprod or #idprodfournprice. this.val = "+$(this).val());
console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). this.val = "+$(this).val());
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva

View File

@@ -225,10 +225,12 @@ if (empty($reshook))
if (!($object->fk_user_author > 0)) $object->fk_user_author = $user->id;
// Check that expense report is for a user inside the hierarchy or advanced permission for all is set
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->writeall_advance))) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) {
$error++;
setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors');
} else {
}
if (!$error) {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) {
if (!in_array($object->fk_user_author, $childids)) {
$error++;

View File

@@ -139,6 +139,8 @@ class CommandeFournisseur extends CommonOrder
public $cond_reglement_id;
public $cond_reglement_code;
public $cond_reglement_label; // Label
public $cond_reglement_doc; // Label on documents
/**
* @var int ID
@@ -312,7 +314,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,";
$sql .= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,";
$sql .= " cm.libelle as methode_commande,";
$sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc,";
$sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_label, cr.libelle_facture as cond_reglement_doc,";
$sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle";
$sql .= ', c.fk_incoterms, c.location_incoterms';
$sql .= ', i.libelle as label_incoterms';
@@ -373,8 +375,9 @@ class CommandeFournisseur extends CommonOrder
$this->fk_project = $obj->fk_project;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
$this->cond_reglement = $obj->cond_reglement_label; // deprecated
$this->cond_reglement_label = $obj->cond_reglement_label;
$this->cond_reglement_doc = $obj->cond_reglement_doc;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
@@ -1562,8 +1565,6 @@ class CommandeFournisseur extends CommonOrder
{
global $langs, $mysoc, $conf;
$error = 0;
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

View File

@@ -176,8 +176,11 @@ class FactureFournisseur extends CommonInvoice
public $note_private;
public $note_public;
public $propalid;
public $cond_reglement_id;
public $cond_reglement_code;
public $cond_reglement_label;
public $cond_reglement_doc;
/**
* @var int ID
@@ -641,8 +644,8 @@ class FactureFournisseur extends CommonInvoice
$sql .= " t.model_pdf,";
$sql .= " t.import_key,";
$sql .= " t.extraparams,";
$sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
$sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,";
$sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_label, cr.libelle_facture as cond_reglement_doc,";
$sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_label,";
$sql .= ' s.nom as socnom, s.rowid as socid,';
$sql .= ' t.fk_incoterms, t.location_incoterms,';
$sql .= " i.libelle as label_incoterms,";
@@ -697,12 +700,13 @@ class FactureFournisseur extends CommonInvoice
$this->fk_project = $obj->fk_project;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle;
$this->cond_reglement = $obj->cond_reglement_label; // deprecated
$this->cond_reglement_label = $obj->cond_reglement_label;
$this->cond_reglement_doc = $obj->cond_reglement_doc;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle;
$this->mode_reglement = $obj->mode_reglement_label;
$this->date_echeance = $this->db->jdate($obj->date_lim_reglement);
$this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private;

View File

@@ -570,7 +570,9 @@ if (empty($reshook))
$fk_unit = GETPOST('units', 'alpha');
$tva_tx = price2num($tva_tx); // When vat is text input field
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx); // When vat is text input field
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);

View File

@@ -30,7 +30,7 @@
-- Types action comm
--
delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,10,30,31,40,50);
delete from llx_c_actioncomm where id in (1,2,3,4,5,6,8,9,10,11,30,31,40,50);
-- Code used from 3.3+ when type of event is used
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 1,'AC_TEL','system','Phone call',NULL, 1, 2);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3);

View File

@@ -73,6 +73,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD'
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ETB', NULL, 1, 'Ethiopian Birr');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar');

View File

@@ -580,3 +580,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
-- Removed no more used function
-- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m CASCADE;
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4);

View File

@@ -223,7 +223,7 @@ if ($ok && GETPOST('standard', 'alpha'))
{
$extrafields = new ExtraFields($db);
$listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product',
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
'socpeople'=>'socpeople', 'propal'=>'propal', 'commande'=>'commande', 'facture'=>'facture',
'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', 'facture_fourn'=>'facture_fourn',
'actioncomm'=>'actioncomm', 'bom_bom'=>'bom_bom', 'mrp_mo'=>'mrp_mo',
'adherent_type'=>'adherent_type', 'user'=>'user', 'projet'=>'projet', 'projet_task'=>'projet_task');

View File

@@ -56,7 +56,8 @@ Paymentnumpad=Type of Pad to enter payment
Numberspad=Numbers Pad
BillsCoinsPad=Coins and banknotes Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs product categories to work
TakeposNeedsCategories=TakePOS needs at least one product categorie to work
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category <b>%s</b> to work
OrderNotes=Order Notes
CashDeskBankAccountFor=Default account to use for payments in
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration

View File

@@ -203,6 +203,7 @@ ProfId2IT=-
ProfId3IT=-
ProfId4IT=-
ProfId5IT=EORI number
ProfId6IT=-
ProfId1LU=Id. prof. 1 (R.C.S. Luxembourg)
ProfId2LU=Id. prof. 2 (Business permit)
ProfId3LU=-

View File

@@ -160,9 +160,13 @@ if (empty($reshook))
if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn;
$quantity = price2num(GETPOST("qty", 'nohtml'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent', 'alpha'));
$npr = preg_match('/\*/', GETPOST('tva_tx', 'alpha')) ? 1 : 0;
$tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha'));
$tva_tx = price2num($tva_tx);
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx);
}
$price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode
$delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : '';
$supplier_reputation = GETPOST('supplier_reputation');

View File

@@ -241,7 +241,7 @@ class Project extends CommonObject
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0;
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$this->fields['fk_opp_status']['enabled'] = 0;
$this->fields['opp_percent']['enabled'] = 0;
$this->fields['opp_amount']['enabled'] = 0;

View File

@@ -720,7 +720,9 @@ if (empty($reshook))
$fk_unit = GETPOST('units', 'alpha');
$tva_tx = price2num($tva_tx); // When vat is text input field
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx); // When vat is text input field
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);

View File

@@ -140,6 +140,7 @@ if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
}
}
}
$levelofmaincategories = $levelofrootcategory + 1;
$maincategories = array();
@@ -961,7 +962,13 @@ if (empty($paiementsModes)) {
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
}
if (count($maincategories) == 0) {
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
$tmpcategory = new Categorie($db);
$tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory", $tmpcategory->label), null, 'errors');
} else {
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
}
}
// User menu and external TakePOS modules
$menus = array();

View File

@@ -530,7 +530,9 @@ if ($action == "freezone") {
$tva_tx = GETPOST('tva_tx', 'alpha');
if ($tva_tx != '') {
$tva_tx = price2num($tva_tx);
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx);
}
} else {
$tva_tx = get_default_tva($mysoc, $customer);
}

View File

@@ -11,6 +11,7 @@ CKEDITOR.editorConfig = function( config )
config.enterMode = CKEDITOR.ENTER_BR;
//config.forceSimpleAmpersand = true; // When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &amp;. We don't want this. But this option does not fix this.
//config.entities = false; // When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &amp;. We don't want this. But this option does not fix this.
//config.entities_greek = false;
config.resize_enabled = false;
//config.resize_maxHeight = 3000;
//config.resize_maxWidth = 3000;

View File

@@ -9,6 +9,9 @@ CKEDITOR.editorConfig = function( config )
// http://docs.cksource.com/CKEditor_3.x/Developers_Guide
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
config.enterMode = CKEDITOR.ENTER_BR;
//config.forceSimpleAmpersand = true; // When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &amp;. We don't want this. But this option does not fix this.
//config.entities = false; // When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &amp;. We don't want this. But this option does not fix this.
//config.entities_greek = false;
config.resize_enabled = false;
//config.resize_maxHeight = 3000;
//config.resize_maxWidth = 3000;

View File

@@ -1396,7 +1396,7 @@ class Website extends CommonObject
'bn'=>'bn_DB',
'bs'=>'bs_BA',
'ca'=>'ca_ES',
'zh'=>'zh_TW',
'zh'=>'zh_CN',
'cs'=>'cs_CZ',
'da'=>'da_DK',
'et'=>'et_EE',