diff --git a/ChangeLog b/ChangeLog index 0f13e4651b1..5b73c4b2212 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ***** diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index cc296e4472a..5eca82f022c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -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 diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4c2f643df1c..6b75d57d082 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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").","; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 1184da6d7ac..45d8c535f2d 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -585,7 +585,7 @@ foreach ($accounts as $key=>$type) if (!empty($arrayfields['balance']['checked'])) { print ''; - print ''.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).''; + print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; print ''; if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance'; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 0d91eb38e7d..0790f149da4 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -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'); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 3072dcdee2b..4f1a3043c76 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -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 ''; if ($modecompta == 'CREANCES-DETTES') print ''.price($total_ht).''; @@ -525,11 +535,12 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_income += $subtotal_ht; $total_ttc_income += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price($subtotal_ht).''; - print ''.price($subtotal_ttc).''; - print ''; + print ''.price($subtotal_ttc).''; + print ''; } /* @@ -609,6 +620,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -686,6 +698,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -764,6 +777,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -841,6 +855,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -926,6 +941,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; print ''.price(-$subtotal_ttc).''; @@ -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 ''; if ($modecompta == 'CREANCES-DETTES') print ''.price($subtotal_ht).''; @@ -1101,8 +1121,10 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_outcome -= 0; $total_ttc_outcome -= $amount; + print ' '; print "".$langs->trans("VATToPay")."\n"; print ' '."\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 ' '; print "".$langs->trans("VATPaid")."\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 ' '; print "".$langs->trans("VATCollected")."\n"; if ($modecompta == 'CREANCES-DETTES') @@ -1279,19 +1306,22 @@ print ''; print ' '; print ''; -print ''.$langs->trans("Outcome").''; -if ($modecompta == 'CREANCES-DETTES') - print ''.price(price2num(-$total_ht_outcome, 'MT')).''; -print ''.price(price2num(-$total_ttc_outcome, 'MT')).''; -print ''; print ''.$langs->trans("Income").''; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht_income, 'MT')).''; +} print ''.price(price2num($total_ttc_income, 'MT')).''; print ''; +print ''.$langs->trans("Outcome").''; +if ($modecompta == 'CREANCES-DETTES') { + print ''.price(price2num(-$total_ht_outcome, 'MT')).''; +} +print ''.price(price2num(-$total_ttc_outcome, 'MT')).''; +print ''; print ''.$langs->trans("Profit").''; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht, 'MT')).''; +} print ''.price(price2num($total_ttc, 'MT')).''; print ''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index ec2a8bb2623..38d0f4ec3f9 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -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; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 8d78b410329..2a08a1f8ffe 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -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'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 36edee80669..7c99a9483b9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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); diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index b68da3170ed..ba15af0de19 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -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 diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 1226d578f2f..a890b1f3ce2 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -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 ''; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 95c5037c5fb..4fa506a23f4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1097,6 +1097,7 @@ if ($action == 'remove_file') $action = ''; } + // Validate records if (!$error && $massaction == 'validate' && $permissiontoadd) { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 53be2725680..f09a80f0227 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -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++; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 045ab92f08e..db436574086 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -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 diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a4a905d256d..58699ddcfba 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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 ) ); diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index ac9285363d7..a706d9a880e 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -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'; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 739035f71a5..8e71f8255e8 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -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"); }); } diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index c72c46c8916..10f8d37a3c8 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -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; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 1bdaeef13ef..0f3023d100d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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)) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 2f1e3d5596b..4602e877bd1 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -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; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f02f04728cd..8d17f9759fb 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -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'); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 3daa5288d7e..c7d83ebbaf7 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -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'); diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index edad675857f..bc6274482c4 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -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"; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 619dcdf84d3..877bf19f3a9 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -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"; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ce44aac0319..9e336863467 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -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'); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 0edcdec536b..aafbb192bce 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -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'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index be3f53847bf..be0d044ac25 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -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'); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index bc71116081e..4e1b448d9db 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -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'); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 275b4672109..74abd0fc715 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -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'); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 2094eab8c3a..99e76b20337 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -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'); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 3d3990c06b4..36f589531e6 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -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'); diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 9e893bf93e3..5239a93fdf7 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -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))) trans("AllEntities"); ?>> + + + + trans("EnabledCondition"); ?> + + + + diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index fb542f9037e..c62a95ec12b 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -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]); diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index d2d77cf3b5c..bbc5ba3370b 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -1,6 +1,6 @@ '."\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)) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index cc74b02a29b..78b679a3ffe 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -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) { 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('trans("rateMustBeNumeric")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; + } + if (npRate == "np_markRate" && rate.val() >= 100) + { + alert('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('trans("rateMustBeNumeric")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; - } - if (npRate == "np_markRate" && rate.val() >= 100) - { - alert('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; } 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=). 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 diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 6ff4c418988..f41f2902e71 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -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++; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 58b39cba8d6..1e6e0234cdc 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 67070b99c57..0157dbd0eec 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -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; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 2ed7ccab8ef..0aea652de68 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -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); diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 9a0d8c223b6..cb22ee70ce3 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -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); diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index d05015721c8..478c263af4c 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -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'); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 9658d6c3051..c297d14eb4a 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -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); + diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 14138dc5664..baac0eb2cbd 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -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'); diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 88ff8fecdb6..7263b04730a 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -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 %s to work OrderNotes=Order Notes CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 99bed13179f..d4c9f95b0b9 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -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=- diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 88c5259f48d..5a989140658 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -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'); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 4fff4297854..c942b68cfe2 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 92d38c519de..9b69d12776a 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -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); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index a08df6d2b43..6e6bdfa1957 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -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(); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 8ca516288c1..243b6b5bc49 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -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); } diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index 50bf77c00ff..e041516a292 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -11,6 +11,7 @@ CKEDITOR.editorConfig = function( config ) config.enterMode = CKEDITOR.ENTER_BR; //config.forceSimpleAmpersand = true; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this. //config.entities = false; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. 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; diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index 50ff0cc6eed..acd38268f8f 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -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 into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this. + //config.entities = false; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. 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; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 34cc78e9a05..d0ffc3ccc03 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -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',