40require
'../main.inc.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/socialnetwork.lib.php';
60const DICT_FORME_JURIDIQUE = 1;
61const DICT_DEPARTEMENTS = 2;
62const DICT_REGIONS = 3;
63const DICT_COUNTRY = 4;
64const DICT_CIVILITY = 5;
65const DICT_ACTIONCOMM = 6;
66const DICT_CHARGESOCIALES = 7;
68const DICT_CURRENCIES = 9;
70const DICT_TYPE_CONTACT = 11;
71const DICT_PAYMENT_TERM = 12;
72const DICT_PAIEMENT = 13;
73const DICT_ECOTAXE = 14;
74const DICT_PAPER_FORMAT = 15;
75const DICT_PROSPECTLEVEL = 16;
76const DICT_TYPE_FEES = 17;
77const DICT_SHIPMENT_MODE = 18;
78const DICT_EFFECTIF = 19;
79const DICT_INPUT_METHOD = 20;
80const DICT_AVAILABILITY = 21;
81const DICT_INPUT_REASON = 22;
82const DICT_REVENUESTAMP = 23;
83const DICT_TYPE_RESOURCE = 24;
84const DICT_TYPE_CONTAINER = 25;
86const DICT_STCOMM = 27;
87const DICT_HOLIDAY_TYPES = 28;
88const DICT_LEAD_STATUS = 29;
89const DICT_FORMAT_CARDS = 30;
90const DICT_INVOICE_SUBTYPE = 31;
91const DICT_HRM_PUBLIC_HOLIDAY = 32;
92const DICT_HRM_DEPARTMENT = 33;
93const DICT_HRM_FUNCTION = 34;
94const DICT_EXP_TAX_CAT = 35;
95const DICT_EXP_TAX_RANGE = 36;
97const DICT_SOCIALNETWORKS = 38;
98const DICT_PROSPECTCONTACTLEVEL = 39;
99const DICT_STCOMMCONTACT = 40;
100const DICT_TRANSPORT_MODE = 41;
101const DICT_PRODUCT_NATURE = 42;
102const DICT_PRODUCTBATCH_QCSTATUS = 43;
103const DICT_ASSET_DISPOSAL_TYPE = 44;
106$langs->loadLangs(array(
"errors",
"admin",
"main",
"companies",
"compta",
"resource",
"holiday",
"accountancy",
"hrm",
"orders",
"contracts",
"projects",
"propal",
"bills",
"interventions",
"ticket"));
108$action =
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view';
109$confirm =
GETPOST(
'confirm',
'alpha');
112$rowid =
GETPOST(
'rowid',
'alpha');
113$entity =
GETPOST(
'entity',
'alpha');
114$code =
GETPOST(
'code',
'alpha');
115$from =
GETPOST(
'from',
'alpha');
119$acts[0] =
"activate";
121$actl[0] = img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
122$actl[1] = img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
126$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
127$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
129if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
133$offset = $listlimit * $page;
134$pageprev = $page - 1;
135$pagenext = $page + 1;
137$search_country_id =
GETPOST(
'search_country_id',
'int');
138$search_code =
GETPOST(
'search_code',
'alpha');
139$search_active =
GETPOST(
'search_active',
'alpha');
143$contextpage =
'dict'.((int) $id);
146if (!
GETPOSTISSET(
'search_country_id') && $search_country_id ==
'' && (
$id == DICT_DEPARTEMENTS ||
$id == DICT_REGIONS ||
$id == DICT_TVA)) {
147 $search_country_id =
$mysoc->country_id;
151$hookmanager->initHooks(array(
'admin',
'dictionaryadmin'));
153$allowed = $user->admin;
154if ($id == DICT_CHARGESOCIALES && $user->hasRight(
'accounting',
'chartofaccount')) {
157if ($id == DICT_TVA && $user->hasRight(
'accounting',
'chartofaccount')) {
160if ($id == DICT_TYPE_FEES && $user->hasRight(
'accounting',
'chartofaccount')) {
167$permissiontoadd = $allowed;
175 DICT_CURRENCIES, DICT_PAPER_FORMAT, DICT_FORMAT_CARDS, 0,
176 DICT_COUNTRY, DICT_REGIONS, DICT_DEPARTEMENTS, 0,
177 DICT_FORME_JURIDIQUE, DICT_TYPENT, DICT_EFFECTIF, DICT_PROSPECTLEVEL, DICT_PROSPECTCONTACTLEVEL, DICT_STCOMM, DICT_STCOMMCONTACT, DICT_SOCIALNETWORKS, 0,
178 DICT_CIVILITY, DICT_TYPE_CONTACT, 0,
179 DICT_ACTIONCOMM, DICT_TYPE_RESOURCE, 0,
181 DICT_HRM_DEPARTMENT, DICT_HRM_FUNCTION, DICT_HRM_PUBLIC_HOLIDAY, DICT_HOLIDAY_TYPES, DICT_TYPE_FEES, DICT_EXP_TAX_CAT, DICT_EXP_TAX_RANGE, 0,
182 DICT_TVA, DICT_INVOICE_SUBTYPE, DICT_REVENUESTAMP, DICT_PAYMENT_TERM, DICT_PAIEMENT, DICT_CHARGESOCIALES, 0,
184 DICT_INPUT_REASON, DICT_INPUT_METHOD, DICT_SHIPMENT_MODE, DICT_AVAILABILITY, DICT_TRANSPORT_MODE, 0,
185 DICT_UNITS, DICT_PRODUCT_NATURE, 0,
186 DICT_PRODUCTBATCH_QCSTATUS, 0,
187 DICT_TYPE_CONTAINER, 0,
188 DICT_ASSET_DISPOSAL_TYPE, 0
193$tabname[DICT_FORME_JURIDIQUE] =
"c_forme_juridique";
194$tabname[DICT_DEPARTEMENTS] =
"c_departements";
195$tabname[DICT_REGIONS] =
"c_regions";
196$tabname[DICT_COUNTRY] =
"c_country";
197$tabname[DICT_CIVILITY] =
"c_civility";
198$tabname[DICT_ACTIONCOMM] =
"c_actioncomm";
199$tabname[DICT_CHARGESOCIALES] =
"c_chargesociales";
200$tabname[DICT_TYPENT] =
"c_typent";
201$tabname[DICT_CURRENCIES] =
"c_currencies";
202$tabname[DICT_TVA] =
"c_tva";
203$tabname[DICT_TYPE_CONTACT] =
"c_type_contact";
204$tabname[DICT_PAYMENT_TERM] =
"c_payment_term";
205$tabname[DICT_PAIEMENT] =
"c_paiement";
206$tabname[DICT_ECOTAXE] =
"c_ecotaxe";
207$tabname[DICT_PAPER_FORMAT] =
"c_paper_format";
208$tabname[DICT_PROSPECTLEVEL] =
"c_prospectlevel";
209$tabname[DICT_TYPE_FEES] =
"c_type_fees";
210$tabname[DICT_SHIPMENT_MODE] =
"c_shipment_mode";
211$tabname[DICT_EFFECTIF] =
"c_effectif";
212$tabname[DICT_INPUT_METHOD] =
"c_input_method";
213$tabname[DICT_AVAILABILITY] =
"c_availability";
214$tabname[DICT_INPUT_REASON] =
"c_input_reason";
215$tabname[DICT_REVENUESTAMP] =
"c_revenuestamp";
216$tabname[DICT_TYPE_RESOURCE] =
"c_type_resource";
217$tabname[DICT_TYPE_CONTAINER] =
"c_type_container";
219$tabname[DICT_STCOMM] =
"c_stcomm";
220$tabname[DICT_HOLIDAY_TYPES] =
"c_holiday_types";
221$tabname[DICT_LEAD_STATUS] =
"c_lead_status";
222$tabname[DICT_FORMAT_CARDS] =
"c_format_cards";
223$tabname[DICT_INVOICE_SUBTYPE] =
"c_invoice_subtype";
224$tabname[DICT_HRM_PUBLIC_HOLIDAY] =
"c_hrm_public_holiday";
225$tabname[DICT_HRM_DEPARTMENT] =
"c_hrm_department";
226$tabname[DICT_HRM_FUNCTION] =
"c_hrm_function";
227$tabname[DICT_EXP_TAX_CAT] =
"c_exp_tax_cat";
228$tabname[DICT_EXP_TAX_RANGE] =
"c_exp_tax_range";
229$tabname[DICT_UNITS] =
"c_units";
230$tabname[DICT_SOCIALNETWORKS] =
"c_socialnetworks";
231$tabname[DICT_PROSPECTCONTACTLEVEL] =
"c_prospectcontactlevel";
232$tabname[DICT_STCOMMCONTACT] =
"c_stcommcontact";
233$tabname[DICT_TRANSPORT_MODE] =
"c_transport_mode";
234$tabname[DICT_PRODUCT_NATURE] =
"c_product_nature";
235$tabname[DICT_PRODUCTBATCH_QCSTATUS] =
"c_productbatch_qcstatus";
236$tabname[DICT_ASSET_DISPOSAL_TYPE] =
"c_asset_disposal_type";
240$tablib[DICT_FORME_JURIDIQUE] =
"DictionaryCompanyJuridicalType";
241$tablib[DICT_DEPARTEMENTS] =
"DictionaryCanton";
242$tablib[DICT_REGIONS] =
"DictionaryRegion";
243$tablib[DICT_COUNTRY] =
"DictionaryCountry";
244$tablib[DICT_CIVILITY] =
"DictionaryCivility";
245$tablib[DICT_ACTIONCOMM] =
"DictionaryActions";
246$tablib[DICT_CHARGESOCIALES] =
"DictionarySocialContributions";
247$tablib[DICT_TYPENT] =
"DictionaryCompanyType";
248$tablib[DICT_CURRENCIES] =
"DictionaryCurrency";
249$tablib[DICT_TVA] =
"DictionaryVAT";
250$tablib[DICT_TYPE_CONTACT] =
"DictionaryTypeContact";
251$tablib[DICT_PAYMENT_TERM] =
"DictionaryPaymentConditions";
252$tablib[DICT_PAIEMENT] =
"DictionaryPaymentModes";
253$tablib[DICT_ECOTAXE] =
"DictionaryEcotaxe";
254$tablib[DICT_PAPER_FORMAT] =
"DictionaryPaperFormat";
255$tablib[DICT_PROSPECTLEVEL] =
"DictionaryProspectLevel";
256$tablib[DICT_TYPE_FEES] =
"DictionaryFees";
257$tablib[DICT_SHIPMENT_MODE] =
"DictionarySendingMethods";
258$tablib[DICT_EFFECTIF] =
"DictionaryStaff";
259$tablib[DICT_INPUT_METHOD] =
"DictionaryOrderMethods";
260$tablib[DICT_AVAILABILITY] =
"DictionaryAvailability";
261$tablib[DICT_INPUT_REASON] =
"DictionarySource";
262$tablib[DICT_REVENUESTAMP] =
"DictionaryRevenueStamp";
263$tablib[DICT_TYPE_RESOURCE] =
"DictionaryResourceType";
264$tablib[DICT_TYPE_CONTAINER] =
"DictionaryTypeOfContainer";
266$tablib[DICT_STCOMM] =
"DictionaryProspectStatus";
267$tablib[DICT_HOLIDAY_TYPES] =
"DictionaryHolidayTypes";
268$tablib[DICT_LEAD_STATUS] =
"DictionaryOpportunityStatus";
269$tablib[DICT_FORMAT_CARDS] =
"DictionaryFormatCards";
270$tablib[DICT_INVOICE_SUBTYPE] =
"DictionaryInvoiceSubtype";
271$tablib[DICT_HRM_PUBLIC_HOLIDAY] =
"DictionaryPublicHolidays";
272$tablib[DICT_HRM_DEPARTMENT] =
"DictionaryDepartment";
273$tablib[DICT_HRM_FUNCTION] =
"DictionaryFunction";
274$tablib[DICT_EXP_TAX_CAT] =
"DictionaryExpenseTaxCat";
275$tablib[DICT_EXP_TAX_RANGE] =
"DictionaryExpenseTaxRange";
276$tablib[DICT_UNITS] =
"DictionaryMeasuringUnits";
277$tablib[DICT_SOCIALNETWORKS] =
"DictionarySocialNetworks";
278$tablib[DICT_PROSPECTCONTACTLEVEL] =
"DictionaryProspectContactLevel";
279$tablib[DICT_STCOMMCONTACT] =
"DictionaryProspectContactStatus";
280$tablib[DICT_TRANSPORT_MODE] =
"DictionaryTransportMode";
281$tablib[DICT_PRODUCT_NATURE] =
"DictionaryProductNature";
282$tablib[DICT_PRODUCTBATCH_QCSTATUS] =
"DictionaryBatchStatus";
283$tablib[DICT_ASSET_DISPOSAL_TYPE] =
"DictionaryAssetDisposalType";
287$tabsql[DICT_FORME_JURIDIQUE] =
"SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX.
"c_forme_juridique as f, ".MAIN_DB_PREFIX.
"c_country as c WHERE f.fk_pays=c.rowid";
288$tabsql[DICT_DEPARTEMENTS] =
"SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX.
"c_departements as d, ".MAIN_DB_PREFIX.
"c_regions as r, ".MAIN_DB_PREFIX.
"c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
289$tabsql[DICT_REGIONS] =
"SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX.
"c_regions as r, ".MAIN_DB_PREFIX.
"c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
290$tabsql[DICT_COUNTRY] =
"SELECT c.rowid as rowid, c.code, c.label, c.phone_code, c.trunk_prefix, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX.
"c_country AS c";
291$tabsql[DICT_CIVILITY] =
"SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX.
"c_civility AS c";
292$tabsql[DICT_ACTIONCOMM] =
"SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX.
"c_actioncomm AS a";
293$tabsql[DICT_CHARGESOCIALES] =
"SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX.
"c_chargesociales AS a, ".MAIN_DB_PREFIX.
"c_country as c WHERE a.fk_pays = c.rowid and c.active = 1";
294$tabsql[DICT_TYPENT] =
"SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.module, t.active FROM ".MAIN_DB_PREFIX.
"c_typent as t LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON t.fk_country=c.rowid";
295$tabsql[DICT_CURRENCIES] =
"SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX.
"c_currencies AS c";
296$tabsql[DICT_TVA] =
"SELECT t.rowid, t.entity, t.code, t.type_vat, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, t.einvoice_vatex, c.label as country, c.code as country_code, t.fk_pays as country_id, t.fk_department_buyer as department_buyer_id, db.nom as department_buyer, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy, t.use_default FROM "
297 .MAIN_DB_PREFIX.
"c_tva as t INNER JOIN "
298 .MAIN_DB_PREFIX.
"c_country as c ON t.fk_pays = c.rowid LEFT JOIN "
299 .MAIN_DB_PREFIX.
"c_departements as db ON t.fk_department_buyer = db.rowid WHERE t.entity IN ("
300 .getEntity($tabname[DICT_TVA]).
")";
301$tabsql[DICT_TYPE_CONTACT] =
"SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX.
"c_type_contact AS t";
302$tabsql[DICT_PAYMENT_TERM] =
"SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX.
"c_payment_term AS c WHERE c.entity IN (".
getEntity($tabname[DICT_PAYMENT_TERM]).
")";
303$tabsql[DICT_PAIEMENT] =
"SELECT c.id as rowid, c.code, c.libelle, c.type, c.accountancy_code, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_paiement AS c WHERE c.entity IN (".
getEntity($tabname[DICT_PAIEMENT]).
")";
304$tabsql[DICT_ECOTAXE] =
"SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX.
"c_ecotaxe AS e, ".MAIN_DB_PREFIX.
"c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
305$tabsql[DICT_PAPER_FORMAT] =
"SELECT t.rowid as rowid, t.code, t.label as libelle, t.width, t.height, t.unit, t.active FROM ".MAIN_DB_PREFIX.
"c_paper_format as t";
306$tabsql[DICT_PROSPECTLEVEL] =
"SELECT t.code, t.label as libelle, t.sortorder, t.active FROM ".MAIN_DB_PREFIX.
"c_prospectlevel as t";
307$tabsql[DICT_TYPE_FEES] =
"SELECT t.id as rowid, t.code, t.label, t.accountancy_code, t.active FROM ".MAIN_DB_PREFIX.
"c_type_fees as t";
308$tabsql[DICT_SHIPMENT_MODE] =
"SELECT t.rowid as rowid, t.code, t.libelle, t.tracking, t.active FROM ".MAIN_DB_PREFIX.
"c_shipment_mode as t";
309$tabsql[DICT_EFFECTIF] =
"SELECT t.id as rowid, t.code, t.libelle, t.active FROM ".MAIN_DB_PREFIX.
"c_effectif as t";
310$tabsql[DICT_INPUT_METHOD] =
"SELECT t.rowid as rowid, t.code, t.libelle, t.active FROM ".MAIN_DB_PREFIX.
"c_input_method as t";
311$tabsql[DICT_AVAILABILITY] =
"SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, c.active, c.position FROM ".MAIN_DB_PREFIX.
"c_availability AS c";
312$tabsql[DICT_INPUT_REASON] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_input_reason as t";
313$tabsql[DICT_REVENUESTAMP] =
"SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX.
"c_revenuestamp as t, ".MAIN_DB_PREFIX.
"c_country as c WHERE t.fk_pays=c.rowid";
314$tabsql[DICT_TYPE_RESOURCE] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_type_resource as t";
315$tabsql[DICT_TYPE_CONTAINER] =
"SELECT t.rowid as rowid, t.entity, t.code, t.label, t.active, t.module FROM ".MAIN_DB_PREFIX.
"c_type_container as t WHERE t.entity IN (".
getEntity($tabname[DICT_TYPE_CONTAINER]).
")";
317$tabsql[DICT_STCOMM] =
"SELECT t.id as rowid, t.code, t.libelle, t.picto, t.active FROM ".MAIN_DB_PREFIX.
"c_stcomm as t";
318$tabsql[DICT_HOLIDAY_TYPES] =
"SELECT h.rowid as rowid, h.entity, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX.
"c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON h.fk_country=c.rowid WHERE h.entity IN (".
getEntity($tabname[DICT_HOLIDAY_TYPES]).
")";
319$tabsql[DICT_LEAD_STATUS] =
"SELECT t.rowid as rowid, t.code, t.label, percent, t.position, t.active FROM ".MAIN_DB_PREFIX.
"c_lead_status as t";
320$tabsql[DICT_FORMAT_CARDS] =
"SELECT t.rowid, t.code, t.name, t.paper_size, t.orientation, t.metric, t.leftmargin, t.topmargin, t.nx, t.ny, t.spacex, t.spacey, t.width, t.height, t.font_size, t.custom_x, t.custom_y, t.active FROM ".MAIN_DB_PREFIX.
"c_format_cards as t";
321$tabsql[DICT_INVOICE_SUBTYPE] =
"SELECT t.rowid, t.code, t.label, c.label as country, c.code as country_code, t.fk_country as country_id, t.active FROM ".MAIN_DB_PREFIX.
"c_invoice_subtype as t, ".MAIN_DB_PREFIX.
"c_country as c WHERE t.fk_country = c.rowid";
322$tabsql[DICT_HRM_PUBLIC_HOLIDAY] =
"SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.dayrule, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX.
"c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country=c.rowid AND c.active=1 WHERE a.entity IN (".
getEntity($tabname[DICT_HRM_PUBLIC_HOLIDAY]).
")";
323$tabsql[DICT_HRM_DEPARTMENT] =
"SELECT t.rowid, t.pos, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_hrm_department as t";
324$tabsql[DICT_HRM_FUNCTION] =
"SELECT t.rowid, t.pos, t.code, t.label, t.c_level, t.active FROM ".MAIN_DB_PREFIX.
"c_hrm_function as t";
325$tabsql[DICT_EXP_TAX_CAT] =
"SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_exp_tax_cat as c";
326$tabsql[DICT_EXP_TAX_RANGE] =
"SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX.
"c_exp_tax_range r";
327$tabsql[DICT_UNITS] =
"SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX.
"c_units r";
328$tabsql[DICT_SOCIALNETWORKS] =
"SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX.
"c_socialnetworks as s WHERE s.entity IN (".
getEntity($tabname[DICT_SOCIALNETWORKS]).
")";
329$tabsql[DICT_PROSPECTCONTACTLEVEL] =
"SELECT t.code, t.label as libelle, t.sortorder, t.active FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel as t";
330$tabsql[DICT_STCOMMCONTACT] =
"SELECT t.id as rowid, t.code, t.libelle, t.picto, t.active FROM ".MAIN_DB_PREFIX.
"c_stcommcontact as t";
331$tabsql[DICT_TRANSPORT_MODE] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_transport_mode as t";
332$tabsql[DICT_PRODUCT_NATURE] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_product_nature as t";
333$tabsql[DICT_PRODUCTBATCH_QCSTATUS] =
"SELECT t.rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_productbatch_qcstatus as t";
334$tabsql[DICT_ASSET_DISPOSAL_TYPE] =
"SELECT t.rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_asset_disposal_type as t";
337$tabsqlsort = array();
338$tabsqlsort[DICT_FORME_JURIDIQUE] =
"country ASC, code ASC";
339$tabsqlsort[DICT_DEPARTEMENTS] =
"country ASC, code ASC";
340$tabsqlsort[DICT_REGIONS] =
"country ASC, code ASC";
341$tabsqlsort[DICT_COUNTRY] =
"code ASC";
342$tabsqlsort[DICT_CIVILITY] =
"label ASC";
343$tabsqlsort[DICT_ACTIONCOMM] =
"a.type ASC, a.module ASC, a.position ASC, a.code ASC";
344$tabsqlsort[DICT_CHARGESOCIALES] =
"c.label ASC, a.code ASC, a.libelle ASC";
345$tabsqlsort[DICT_TYPENT] =
"country DESC,".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
' t.position ASC,' :
'').
" libelle ASC";
346$tabsqlsort[DICT_CURRENCIES] =
"label ASC";
347$tabsqlsort[DICT_TVA] =
"country ASC, department_buyer ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
348$tabsqlsort[DICT_TYPE_CONTACT] =
"t.element ASC, t.source ASC, t.position ASC, t.code ASC";
349$tabsqlsort[DICT_PAYMENT_TERM] =
"sortorder ASC, code ASC";
350$tabsqlsort[DICT_PAIEMENT] =
"code ASC";
351$tabsqlsort[DICT_ECOTAXE] =
"country ASC, e.organization ASC, code ASC";
352$tabsqlsort[DICT_PAPER_FORMAT] =
"rowid ASC";
353$tabsqlsort[DICT_PROSPECTLEVEL] =
"sortorder ASC";
354$tabsqlsort[DICT_TYPE_FEES] =
"code ASC";
355$tabsqlsort[DICT_SHIPMENT_MODE] =
"code ASC, libelle ASC";
356$tabsqlsort[DICT_EFFECTIF] =
"id ASC";
357$tabsqlsort[DICT_INPUT_METHOD] =
"code ASC, libelle ASC";
358$tabsqlsort[DICT_AVAILABILITY] =
"position ASC, type_duration ASC, qty ASC";
359$tabsqlsort[DICT_INPUT_REASON] =
"code ASC, label ASC";
360$tabsqlsort[DICT_REVENUESTAMP] =
"country ASC, taux ASC";
361$tabsqlsort[DICT_TYPE_RESOURCE] =
"code ASC, label ASC";
362$tabsqlsort[DICT_TYPE_CONTAINER] =
"t.module ASC, t.code ASC, t.label ASC";
364$tabsqlsort[DICT_STCOMM] =
"code ASC";
365$tabsqlsort[DICT_HOLIDAY_TYPES] =
"sortorder ASC, country ASC, code ASC";
366$tabsqlsort[DICT_LEAD_STATUS] =
"position ASC";
367$tabsqlsort[DICT_FORMAT_CARDS] =
"code ASC";
368$tabsqlsort[DICT_INVOICE_SUBTYPE] =
"country ASC, code ASC";
369$tabsqlsort[DICT_HRM_PUBLIC_HOLIDAY] =
"country, year ASC, month ASC, day ASC";
370$tabsqlsort[DICT_HRM_DEPARTMENT] =
"code ASC";
371$tabsqlsort[DICT_HRM_FUNCTION] =
"code ASC";
372$tabsqlsort[DICT_EXP_TAX_CAT] =
"c.label ASC";
373$tabsqlsort[DICT_EXP_TAX_RANGE] =
"r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
374$tabsqlsort[DICT_UNITS] =
"sortorder ASC";
375$tabsqlsort[DICT_SOCIALNETWORKS] =
"rowid, code ASC";
376$tabsqlsort[DICT_PROSPECTCONTACTLEVEL] =
"sortorder ASC";
377$tabsqlsort[DICT_STCOMMCONTACT] =
"code ASC";
378$tabsqlsort[DICT_TRANSPORT_MODE] =
"code ASC";
379$tabsqlsort[DICT_PRODUCT_NATURE] =
"code ASC";
380$tabsqlsort[DICT_PRODUCTBATCH_QCSTATUS] =
"code ASC";
381$tabsqlsort[DICT_ASSET_DISPOSAL_TYPE] =
"code ASC";
385$tabfield[DICT_FORME_JURIDIQUE] =
"code,libelle,country";
386$tabfield[DICT_DEPARTEMENTS] =
"code,libelle,region_id,region,country";
387$tabfield[DICT_REGIONS] =
"code,libelle,country_id,country";
388$tabfield[DICT_COUNTRY] =
"code,label,phone_code,trunk_prefix";
389$tabfield[DICT_CIVILITY] =
"code,label";
390$tabfield[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
391$tabfield[DICT_CHARGESOCIALES] =
"code,libelle,country,accountancy_code";
392$tabfield[DICT_TYPENT] =
"code,libelle,module,country_id,country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
393$tabfield[DICT_CURRENCIES] =
"code,label,unicode";
394$tabfield[DICT_TVA] =
"country_id,country,department_buyer_id,department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,einvoice_vatex,accountancy_code_sell,accountancy_code_buy,use_default,note";
395$tabfield[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
396$tabfield[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
397$tabfield[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code";
398$tabfield[DICT_ECOTAXE] =
"code,label,price,organization,country";
399$tabfield[DICT_PAPER_FORMAT] =
"code,libelle,width,height,unit";
400$tabfield[DICT_PROSPECTLEVEL] =
"code,libelle,sortorder";
401$tabfield[DICT_TYPE_FEES] =
"code,label,accountancy_code";
402$tabfield[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
403$tabfield[DICT_EFFECTIF] =
"code,libelle";
404$tabfield[DICT_INPUT_METHOD] =
"code,libelle";
405$tabfield[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
406$tabfield[DICT_INPUT_REASON] =
"code,label";
407$tabfield[DICT_REVENUESTAMP] =
"country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
408$tabfield[DICT_TYPE_RESOURCE] =
"code,label";
409$tabfield[DICT_TYPE_CONTAINER] =
"code,label";
411$tabfield[DICT_STCOMM] =
"code,libelle,picto";
412$tabfield[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
413$tabfield[DICT_LEAD_STATUS] =
"code,label,percent,position";
414$tabfield[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
415$tabfield[DICT_INVOICE_SUBTYPE] =
"country_id,country,code,label";
416$tabfield[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,year,month,day,country_id,country";
417$tabfield[DICT_HRM_DEPARTMENT] =
"code,label";
418$tabfield[DICT_HRM_FUNCTION] =
"code,label";
419$tabfield[DICT_EXP_TAX_CAT] =
"label";
420$tabfield[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
421$tabfield[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
422$tabfield[DICT_SOCIALNETWORKS] =
"code,label,url,icon";
423$tabfield[DICT_PROSPECTCONTACTLEVEL] =
"code,libelle,sortorder";
424$tabfield[DICT_STCOMMCONTACT] =
"code,libelle,picto";
425$tabfield[DICT_TRANSPORT_MODE] =
"code,label";
426$tabfield[DICT_PRODUCT_NATURE] =
"code,label";
427$tabfield[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
428$tabfield[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
435$tabfieldmain = array();
436$tabfieldmain[DICT_FORME_JURIDIQUE] =
"code,libelle,country";
437$tabfieldmain[DICT_DEPARTEMENTS] =
"code,libelle,region,country";
438$tabfieldmain[DICT_REGIONS] =
"code,libelle,country";
439$tabfieldmain[DICT_COUNTRY] =
"code,label,phone_code,trunk_prefix";
440$tabfieldmain[DICT_CIVILITY] =
"code,label";
441$tabfieldmain[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
442$tabfieldmain[DICT_CHARGESOCIALES] =
"code,libelle,country,accountancy_code";
443$tabfieldmain[DICT_TYPENT] =
"code,libelle,module,country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
444$tabfieldmain[DICT_CURRENCIES] =
"code,label,unicode";
445$tabfieldmain[DICT_TVA] =
"country,department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,einvoice_vatex,accountancy_code_sell,accountancy_code_buy,use_default";
446$tabfieldmain[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
447$tabfieldmain[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
448$tabfieldmain[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code";
449$tabfieldmain[DICT_ECOTAXE] =
"code,label,price,organization,country";
450$tabfieldmain[DICT_PAPER_FORMAT] =
"code,libelle,width,height,unit";
451$tabfieldmain[DICT_PROSPECTLEVEL] =
"code,libelle,sortorder";
452$tabfieldmain[DICT_TYPE_FEES] =
"code,label,accountancy_code";
453$tabfieldmain[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
454$tabfieldmain[DICT_EFFECTIF] =
"code,libelle";
455$tabfieldmain[DICT_INPUT_METHOD] =
"code,libelle";
456$tabfieldmain[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
457$tabfieldmain[DICT_INPUT_REASON] =
"code,label";
458$tabfieldmain[DICT_REVENUESTAMP] =
"country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
459$tabfieldmain[DICT_TYPE_RESOURCE] =
"code,label";
460$tabfieldmain[DICT_TYPE_CONTAINER] =
"code,label";
461$tabfieldmain[DICT_STCOMM] =
"code,libelle,picto";
462$tabfieldmain[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
463$tabfieldmain[DICT_LEAD_STATUS] =
"code,label,percent,position";
464$tabfieldmain[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
465$tabfieldmain[DICT_INVOICE_SUBTYPE] =
"country,code,label";
466$tabfieldmain[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,year,month,day,country";
467$tabfieldmain[DICT_HRM_DEPARTMENT] =
"code,label";
468$tabfieldmain[DICT_HRM_FUNCTION] =
"code,label";
469$tabfieldmain[DICT_EXP_TAX_CAT] =
"label";
470$tabfieldmain[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
471$tabfieldmain[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
472$tabfieldmain[DICT_SOCIALNETWORKS] =
"code,label,url,icon";
473$tabfieldmain[DICT_PROSPECTCONTACTLEVEL] =
"code,libelle,sortorder";
474$tabfieldmain[DICT_STCOMMCONTACT] =
"code,libelle,picto";
475$tabfieldmain[DICT_TRANSPORT_MODE] =
"code,label";
476$tabfieldmain[DICT_PRODUCT_NATURE] =
"code,label";
477$tabfieldmain[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
478$tabfieldmain[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
481$tabfieldvalue = array();
482$tabfieldvalue[DICT_FORME_JURIDIQUE] =
"code,libelle,country";
483$tabfieldvalue[DICT_DEPARTEMENTS] =
"code,libelle,region";
484$tabfieldvalue[DICT_REGIONS] =
"code,libelle,country";
485$tabfieldvalue[DICT_COUNTRY] =
"code,label,phone_code,trunk_prefix";
486$tabfieldvalue[DICT_CIVILITY] =
"code,label";
487$tabfieldvalue[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
488$tabfieldvalue[DICT_CHARGESOCIALES] =
"code,libelle,country,accountancy_code";
489$tabfieldvalue[DICT_TYPENT] =
"code,libelle,country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
490$tabfieldvalue[DICT_CURRENCIES] =
"code,label,unicode";
491$tabfieldvalue[DICT_TVA] =
"country,department_buyer_id,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,einvoice_vatex,accountancy_code_sell,accountancy_code_buy,use_default,note";
492$tabfieldvalue[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
493$tabfieldvalue[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
494$tabfieldvalue[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code";
495$tabfieldvalue[DICT_ECOTAXE] =
"code,label,price,organization,country";
496$tabfieldvalue[DICT_PAPER_FORMAT] =
"code,libelle,width,height,unit";
497$tabfieldvalue[DICT_PROSPECTLEVEL] =
"code,libelle,sortorder";
498$tabfieldvalue[DICT_TYPE_FEES] =
"code,label,accountancy_code";
499$tabfieldvalue[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
500$tabfieldvalue[DICT_EFFECTIF] =
"code,libelle";
501$tabfieldvalue[DICT_INPUT_METHOD] =
"code,libelle";
502$tabfieldvalue[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
503$tabfieldvalue[DICT_INPUT_REASON] =
"code,label";
504$tabfieldvalue[DICT_REVENUESTAMP] =
"country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
505$tabfieldvalue[DICT_TYPE_RESOURCE] =
"code,label";
506$tabfieldvalue[DICT_TYPE_CONTAINER] =
"code,label";
508$tabfieldvalue[DICT_STCOMM] =
"code,libelle,picto";
509$tabfieldvalue[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
510$tabfieldvalue[DICT_LEAD_STATUS] =
"code,label,percent,position";
511$tabfieldvalue[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
512$tabfieldvalue[DICT_INVOICE_SUBTYPE] =
"country,code,label";
513$tabfieldvalue[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,day,month,year,country";
514$tabfieldvalue[DICT_HRM_DEPARTMENT] =
"code,label";
515$tabfieldvalue[DICT_HRM_FUNCTION] =
"code,label";
516$tabfieldvalue[DICT_EXP_TAX_CAT] =
"label";
517$tabfieldvalue[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
518$tabfieldvalue[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
519$tabfieldvalue[DICT_SOCIALNETWORKS] =
"code,label,url,icon";
520$tabfieldvalue[DICT_PROSPECTCONTACTLEVEL] =
"code,libelle,sortorder";
521$tabfieldvalue[DICT_STCOMMCONTACT] =
"code,libelle,picto";
522$tabfieldvalue[DICT_TRANSPORT_MODE] =
"code,label";
523$tabfieldvalue[DICT_PRODUCT_NATURE] =
"code,label";
524$tabfieldvalue[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
525$tabfieldvalue[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
528$tabfieldinsert = array();
529$tabfieldinsert[DICT_FORME_JURIDIQUE] =
"code,libelle,fk_pays";
530$tabfieldinsert[DICT_DEPARTEMENTS] =
"code_departement,nom,fk_region";
531$tabfieldinsert[DICT_REGIONS] =
"code_region,nom,fk_pays";
532$tabfieldinsert[DICT_COUNTRY] =
"code,label,phone_code,trunk_prefix";
533$tabfieldinsert[DICT_CIVILITY] =
"code,label";
534$tabfieldinsert[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
535$tabfieldinsert[DICT_CHARGESOCIALES] =
"code,libelle,fk_pays,accountancy_code";
536$tabfieldinsert[DICT_TYPENT] =
"code,libelle,fk_country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
537$tabfieldinsert[DICT_CURRENCIES] =
"code_iso,label,unicode";
538$tabfieldinsert[DICT_TVA] =
"fk_pays,fk_department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,einvoice_vatex,accountancy_code_sell,accountancy_code_buy,use_default,note,entity";
539$tabfieldinsert[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
540$tabfieldinsert[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
541$tabfieldinsert[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code,entity";
542$tabfieldinsert[DICT_ECOTAXE] =
"code,label,price,organization,fk_pays";
543$tabfieldinsert[DICT_PAPER_FORMAT] =
"code,label,width,height,unit";
544$tabfieldinsert[DICT_PROSPECTLEVEL] =
"code,label,sortorder";
545$tabfieldinsert[DICT_TYPE_FEES] =
"code,label,accountancy_code";
546$tabfieldinsert[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
547$tabfieldinsert[DICT_EFFECTIF] =
"code,libelle";
548$tabfieldinsert[DICT_INPUT_METHOD] =
"code,libelle";
549$tabfieldinsert[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
550$tabfieldinsert[DICT_INPUT_REASON] =
"code,label";
551$tabfieldinsert[DICT_REVENUESTAMP] =
"fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
552$tabfieldinsert[DICT_TYPE_RESOURCE] =
"code,label";
553$tabfieldinsert[DICT_TYPE_CONTAINER] =
"code,label,entity";
555$tabfieldinsert[DICT_STCOMM] =
"code,libelle,picto";
556$tabfieldinsert[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder,entity";
557$tabfieldinsert[DICT_LEAD_STATUS] =
"code,label,percent,position";
558$tabfieldinsert[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
559$tabfieldinsert[DICT_INVOICE_SUBTYPE] =
"fk_country,code,label";
560$tabfieldinsert[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,day,month,year,fk_country,entity";
561$tabfieldinsert[DICT_HRM_DEPARTMENT] =
"code,label";
562$tabfieldinsert[DICT_HRM_FUNCTION] =
"code,label";
563$tabfieldinsert[DICT_EXP_TAX_CAT] =
"label";
564$tabfieldinsert[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
565$tabfieldinsert[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
566$tabfieldinsert[DICT_SOCIALNETWORKS] =
"code,label,url,icon,entity";
567$tabfieldinsert[DICT_PROSPECTCONTACTLEVEL] =
"code,label,sortorder";
568$tabfieldinsert[DICT_STCOMMCONTACT] =
"code,libelle,picto";
569$tabfieldinsert[DICT_TRANSPORT_MODE] =
"code,label";
570$tabfieldinsert[DICT_PRODUCT_NATURE] =
"code,label";
571$tabfieldinsert[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
572$tabfieldinsert[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
578$tabrowid[DICT_FORME_JURIDIQUE] =
"";
579$tabrowid[DICT_DEPARTEMENTS] =
"";
580$tabrowid[DICT_REGIONS] =
"";
581$tabrowid[DICT_COUNTRY] =
"rowid";
582$tabrowid[DICT_CIVILITY] =
"rowid";
583$tabrowid[DICT_ACTIONCOMM] =
"id";
584$tabrowid[DICT_CHARGESOCIALES] =
"id";
585$tabrowid[DICT_TYPENT] =
"id";
586$tabrowid[DICT_CURRENCIES] =
"code_iso";
587$tabrowid[DICT_TVA] =
"";
588$tabrowid[DICT_TYPE_CONTACT] =
"rowid";
589$tabrowid[DICT_PAYMENT_TERM] =
"";
590$tabrowid[DICT_PAIEMENT] =
"id";
591$tabrowid[DICT_ECOTAXE] =
"";
592$tabrowid[DICT_PAPER_FORMAT] =
"";
593$tabrowid[DICT_PROSPECTLEVEL] =
"code";
594$tabrowid[DICT_TYPE_FEES] =
"id";
595$tabrowid[DICT_SHIPMENT_MODE] =
"rowid";
596$tabrowid[DICT_EFFECTIF] =
"id";
597$tabrowid[DICT_INPUT_METHOD] =
"";
598$tabrowid[DICT_AVAILABILITY] =
"rowid";
599$tabrowid[DICT_INPUT_REASON] =
"rowid";
600$tabrowid[DICT_REVENUESTAMP] =
"";
601$tabrowid[DICT_TYPE_RESOURCE] =
"";
602$tabrowid[DICT_TYPE_CONTAINER] =
"";
604$tabrowid[DICT_STCOMM] =
"id";
605$tabrowid[DICT_HOLIDAY_TYPES] =
"";
606$tabrowid[DICT_LEAD_STATUS] =
"";
607$tabrowid[DICT_FORMAT_CARDS] =
"";
608$tabrowid[DICT_INVOICE_SUBTYPE] =
"";
609$tabrowid[DICT_HRM_PUBLIC_HOLIDAY] =
"id";
610$tabrowid[DICT_HRM_DEPARTMENT] =
"rowid";
611$tabrowid[DICT_HRM_FUNCTION] =
"rowid";
612$tabrowid[DICT_EXP_TAX_CAT] =
"";
613$tabrowid[DICT_EXP_TAX_RANGE] =
"";
614$tabrowid[DICT_UNITS] =
"";
615$tabrowid[DICT_SOCIALNETWORKS] =
"";
616$tabrowid[DICT_PROSPECTCONTACTLEVEL] =
"code";
617$tabrowid[DICT_STCOMMCONTACT] =
"id";
618$tabrowid[DICT_TRANSPORT_MODE] =
"";
619$tabrowid[DICT_PRODUCT_NATURE] =
"rowid";
620$tabrowid[DICT_PRODUCTBATCH_QCSTATUS] =
"rowid";
621$tabrowid[DICT_ASSET_DISPOSAL_TYPE] =
"rowid";
625$tabcond[DICT_FORME_JURIDIQUE] = (
isModEnabled(
"societe"));
626$tabcond[DICT_DEPARTEMENTS] =
true;
627$tabcond[DICT_REGIONS] =
true;
628$tabcond[DICT_COUNTRY] =
true;
633$tabcond[DICT_CURRENCIES] =
true;
634$tabcond[DICT_TVA] =
true;
639$tabcond[DICT_PAPER_FORMAT] =
true;
644$tabcond[DICT_INPUT_METHOD] =
isModEnabled(
"supplier_order");
647$tabcond[DICT_REVENUESTAMP] =
true;
662$tabcond[DICT_SOCIALNETWORKS] =
isModEnabled(
'socialnetworks');
665$tabcond[DICT_TRANSPORT_MODE] =
isModEnabled(
'intracommreport');
668$tabcond[DICT_ASSET_DISPOSAL_TYPE] =
isModEnabled(
'asset');
674$tooltipvatex = $langs->trans(
"VATExemptionCodeDesc").
'<br>'.$langs->trans(
"VATExemptionCodeDesc2").
'<br>'.$langs->trans(
"VATExemptionCodeDesc3");
675if ((
$mysoc->country_code ==
'FR')) {
676 $tooltipvatex .=
'<br><br>'.$langs->trans(
"Example").
':<br>';
677 $tooltipvatex .=
'VATEX-FR-FRANCHISE, VATEX-FR-CGI261-4, VATEX-FR-J, VATEX-FR-I, VATEX-FR-D, ...';
682 'c_forme_juridique' => array(
683 'picto' =>
'company',
684 'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))
686 'c_departements' => array(
688 'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))
690 'c_regions' => array(
692 'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))
694 'c_country' => array(
'picto' =>
'country',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'phone_code' =>
'e.g. 33',
'trunk_prefix' =>
'e.g. 0')),
695 'c_civility' => array(
'picto' =>
'contact',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
696 'c_actioncomm' => array(
'picto' =>
'action',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'color' => $langs->trans(
"ColorFormat"),
'position' => $langs->trans(
"PositionIntoComboList"))),
697 'c_chargesociales' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
698 'c_typent' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'position' => $langs->trans(
"PositionIntoComboList"))),
699 'c_currencies' => array(
'picto' =>
'multicurrency',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'unicode' => $langs->trans(
"UnicodeCurrency"))),
700 'c_tva' => array(
'picto' =>
'bill',
'css' => array(
'einvoice_vatex' =>
'tdoverflowmax100'),
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'taux' => $langs->trans(
"SellTaxRate"),
'recuperableonly' => $langs->trans(
"RecuperableOnly"),
'localtax1_type' => $langs->trans(
"LocalTaxDesc"),
'localtax2_type' => $langs->trans(
"LocalTaxDesc"),
'einvoice_vatex' => $tooltipvatex)),
701 'c_type_contact' => array(
'picto' =>
'contact',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'position' => $langs->trans(
"PositionIntoComboList"))),
702 'c_payment_term' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'type_cdr' => $langs->trans(
"TypeCdr", $langs->transnoentitiesnoconv(
"NbOfDays"), $langs->transnoentitiesnoconv(
"Offset"), $langs->transnoentitiesnoconv(
"NbOfDays"), $langs->transnoentitiesnoconv(
"Offset")))),
703 'c_paiement' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
704 'c_ecotaxe' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
705 'c_paper_format' => array(
'picto' =>
'generic',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
706 'c_prospectlevel' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
707 'c_type_fees' => array(
'picto' =>
'trip',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
708 'c_shipment_mode' => array(
'picto' =>
'shipment',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'tracking' => $langs->trans(
"UrlTrackingDesc"))),
709 'c_effectif' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
710 'c_input_method' => array(
'picto' =>
'order',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
711 'c_input_reason' => array(
'picto' =>
'order',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'position' => $langs->trans(
"PositionIntoComboList"))),
712 'c_availability' => array(
'picto' =>
'shipment',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
713 'c_revenuestamp' => array(
'picto' =>
'bill',
'help' => array(
'revenuestamp_type' => $langs->trans(
'FixedOrPercent'))),
714 'c_type_resource' => array(
'picto' =>
'resource',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
715 'c_type_container' => array(
'picto' =>
'website',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
716 'c_stcomm' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'picto' => $langs->trans(
"PictoHelp"))),
717 'c_holiday_types' => array(
'picto' =>
'holiday',
'help' => array(
'affect' => $langs->trans(
"FollowedByACounter"),
'delay' => $langs->trans(
"MinimumNoticePeriod"),
'newbymonth' => $langs->trans(
"NbAddedAutomatically"))),
718 'c_lead_status' => array(
'picto' =>
'project',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'percent' => $langs->trans(
"OpportunityPercent"),
'position' => $langs->trans(
"PositionIntoComboList"))),
719 'c_format_cards' => array(
'picto' =>
'generic',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'name' => $langs->trans(
"LabelName"),
'paper_size' => $langs->trans(
"LabelPaperSize"))),
720 'c_hrm_public_holiday' => array(
'picto' =>
'holiday',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'dayrule' =>
"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.",
'country' => $langs->trans(
"CountryIfSpecificToOneCountry"),
'year' => $langs->trans(
"ZeroMeansEveryYear"))),
721 'c_hrm_department' => array(
'picto' =>
'hrm',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
722 'c_hrm_function' => array(
'picto' =>
'hrm',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
723 'c_exp_tax_cat' => array(
'picto' =>
'expensereport',
'help' => array()),
724 'c_exp_tax_range' => array(
'picto' =>
'expensereport',
'help' => array(
'range_ik' => $langs->trans(
'PrevRangeToThisRange'))),
725 'c_units' => array(
'picto' =>
'product',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'unit_type' => $langs->trans(
'Measuringtype_durationDesc'),
'scale' => $langs->trans(
'MeasuringScaleDesc'))),
726 'c_socialnetworks' => array(
'picto' =>
'share-alt',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'url' => $langs->trans(
'UrlSocialNetworksDesc'),
'icon' => $langs->trans(
'FafaIconSocialNetworksDesc'))),
727 'c_prospectcontactlevel' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
728 'c_stcommcontact' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'picto' => $langs->trans(
"PictoHelp"))),
729 'c_transport_mode' => array(
'picto' =>
'incoterm',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
730 'c_product_nature' => array(
'picto' =>
'product',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
731 'c_productbatch_qcstatus' => array(
'picto' =>
'lot',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
732 'c_asset_disposal_type' => array(
'picto' =>
'asset',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
733 'c_invoice_subtype' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
738complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabcomplete);
742foreach ($tabcomplete as $key => $value) {
745 if (!isset($tabcond[$i])) {
748 $tabcomplete[$key][
'id'] = $i;
751 $tabcomplete[$key][
'cond'] = $tabcond[$i];
752 $tabcomplete[$key][
'rowid'] = $tabrowid[$i];
753 $tabcomplete[$key][
'fieldinsert'] = $tabfieldinsert[$i];
754 $tabcomplete[$key][
'fieldvalue'] = $tabfieldvalue[$i];
755 $tabcomplete[$key][
'lib'] = $tablib[$i];
756 $tabcomplete[$key][
'sql'] = $tabsql[$i];
757 $tabcomplete[$key][
'sqlsort'] = $tabsqlsort[$i];
758 $tabcomplete[$key][
'field'] = $tabfield[$i];
765 $arrayofkeys = array_keys($tabcomplete);
766 if (array_key_exists($id - 1, $arrayofkeys)) {
767 $keytable = $arrayofkeys[
$id - 1];
772if (empty($sortfield)) {
773 $tmp1 = explode(
',', empty($tabcomplete[$keytable][
'sqlsort']) ?
'' : $tabcomplete[$keytable][
'sqlsort']);
774 $tmp2 = explode(
' ', $tmp1[0]);
775 $sortfield = preg_replace(
'/^.*\./',
'', $tmp2[0]);
776 $sortorder = (!empty($tmp2[1]) ? $tmp2[1] :
'');
780global $elementList, $sourceList, $localtax_typeList, $type_vatList;
783$elementList = array();
784$sourceList = array();
785if ($id == DICT_TYPE_CONTACT) {
786 $elementList = array(
788 'agenda' => img_picto(
'',
'action',
'class="pictofixedwidth"').$langs->trans(
'Agenda'),
789 'dolresource' => img_picto(
'',
'resource',
'class="pictofixedwidth"').$langs->trans(
'Resource'),
790 'societe' => img_picto(
'',
'company',
'class="pictofixedwidth"').$langs->trans(
'ThirdParty'),
791 'product' => img_picto(
'',
'product',
'class="pictofixedwidth"').$langs->trans(
'Product'),
797 'project' => img_picto(
'',
'project',
'class="pictofixedwidth"').$langs->trans(
'Project'),
798 'project_task' => img_picto(
'',
'projecttask',
'class="pictofixedwidth"').$langs->trans(
'Task'),
799 'propal' => img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
'Proposal'),
800 'commande' => img_picto(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
'Order'),
801 'shipping' => img_picto(
'',
'dolly',
'class="pictofixedwidth"') . $langs->trans(
'Shipment'),
802 'facture' => img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
'Bill'),
803 'fichinter' => img_picto(
'',
'intervention',
'class="pictofixedwidth"').$langs->trans(
'InterventionCard'),
804 'contrat' => img_picto(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
'Contract'),
805 'ticket' => img_picto(
'',
'ticket',
'class="pictofixedwidth"').$langs->trans(
'Ticket'),
806 'supplier_proposal' => img_picto(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
'SupplierProposal'),
807 'order_supplier' => img_picto(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
'SupplierOrder'),
808 'invoice_supplier' => img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
'SupplierBill'),
809 'conferenceorbooth' => img_picto(
'',
'eventorganization',
'class="pictofixedwidth"').$langs->trans(
'ConferenceOrBooth'),
812 complete_elementList_with_modules($elementList);
816 'internal' => $langs->trans(
'Internal'),
817 'external' => $langs->trans(
'External')
822$type_vatList = array(
823 "0" => $langs->trans(
"Sell").
'+'.$langs->trans(
"Buy"),
824 "1" => $langs->trans(
"Sell"),
825 "2" => $langs->trans(
"Buy")
829$localtax_typeList = array(
830 "0" => $langs->trans(
"No"),
831 "1" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 1)",
832 "2" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 2)",
833 "3" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 3)",
834 "4" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 4)",
835 "5" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 5)",
836 "6" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 6)"
850 'confirm' => $confirm,
852 'taborder' => $taborder,
853 'tabname' => $tabname,
856 'tabsqlsort' => $tabsqlsort,
857 'tabfield' => $tabfield,
858 'tabfieldvalue' => $tabfieldvalue,
859 'tabfieldinsert' => $tabfieldinsert,
860 'tabrowid' => $tabrowid,
861 'tabcond' => $tabcond,
862 'tabhelp' => $tabhelp,
863 'tabcomplete' => $tabcomplete
865$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
867 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
870if (
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha')) {
871 $search_country_id =
'';
876if (empty($reshook)) {
878 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
882 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
883 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
884 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
885 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
889 foreach ($listfield as $f => $value) {
891 if ($value ==
'country_id' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryVAT',
'DictionaryInvoiceSubtype',
'DictionaryRegion',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp',
'DictionaryAccountancysystem',
'DictionaryAccountancyCategory'))) {
894 if ($value ==
'country' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryCanton',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp'))) {
898 if (
GETPOST(
'actionadd') && $value ==
'department_buyer_id' && $tablib[$id] ==
'DictionaryVAT') {
902 if ($value ==
'department_buyer' && $tablib[$id] ==
'DictionaryVAT') {
906 $notmandatoryarray = array(
'localtax1',
'localtax2',
'color',
'formula',
'dayrule',
'einvoice_vatex');
907 foreach ($notmandatoryarray as $notmandatory) {
912 if ($value ==
'sortorder') {
917 !in_array($value, array(
'decalage',
'module',
'accountancy_code',
'accountancy_code_sell',
'accountancy_code_buy',
'tracking',
'picto',
'deposit_percent'))
918 && ($id != DICT_TVA || ($value !=
'code' && $value !=
'note'))
922 $fieldnamekey = $value;
924 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
925 $fieldnamekey =
'Label';
927 if ($fieldnamekey ==
'libelle_facture') {
928 $fieldnamekey =
'LabelOnDocuments';
930 if ($fieldnamekey ==
'deposit_percent') {
931 $fieldnamekey =
'DepositPercent';
933 if ($fieldnamekey ==
'nbjour') {
934 $fieldnamekey =
'NbOfDays';
936 if ($fieldnamekey ==
'decalage') {
937 $fieldnamekey =
'Offset';
939 if ($fieldnamekey ==
'module') {
940 $fieldnamekey =
'Module';
942 if ($fieldnamekey ==
'code') {
943 $fieldnamekey =
'Code';
945 if ($fieldnamekey ==
'note') {
946 $fieldnamekey =
'Note';
948 if ($fieldnamekey ==
'taux') {
949 $fieldnamekey =
'Rate';
951 if ($fieldnamekey ==
'type') {
952 $fieldnamekey =
'Type';
954 if ($fieldnamekey ==
'position') {
955 $fieldnamekey =
'Position';
957 if ($fieldnamekey ==
'unicode') {
958 $fieldnamekey =
'Unicode';
960 if ($fieldnamekey ==
'deductible') {
961 $fieldnamekey =
'Deductible';
963 if ($fieldnamekey ==
'sortorder') {
964 $fieldnamekey =
'SortOrder';
966 if ($fieldnamekey ==
'category_type') {
967 $fieldnamekey =
'Calculated';
969 if ($fieldnamekey ==
'revenuestamp_type') {
970 $fieldnamekey =
'TypeOfRevenueStamp';
972 if ($fieldnamekey ==
'use_default') {
973 $fieldnamekey =
'UseByDefault';
976 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
980 if (
GETPOST(
'actionadd') && $tabname[$id] ==
"c_actioncomm" &&
GETPOSTISSET(
"type") && in_array(
GETPOST(
"type"), array(
'system',
'systemauto'))) {
982 setEventMessages($langs->transnoentities(
'ErrorReservedTypeSystemSystemAuto'),
null,
'errors');
987 setEventMessages($langs->transnoentities(
'ErrorCodeCantContainZero'),
null,
'errors');
990 if (
GETPOSTISSET(
"country") && (
GETPOST(
"country") ==
'0') && ($id != DICT_DEPARTEMENTS)) {
991 if (in_array($tablib[$id], array(
'DictionaryCompanyType',
'DictionaryHolidayTypes'))) {
992 $_POST[
"country"] =
'';
995 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities(
"Country")),
null,
'errors');
998 if (($id == DICT_REGIONS || $id == DICT_PRODUCT_NATURE) && !is_numeric(
GETPOST(
"code")) &&
GETPOST(
'actionadd')) {
1000 setEventMessages($langs->transnoentities(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Code")),
null,
'errors');
1002 if ($id == DICT_COUNTRY && strlen(
GETPOST(
"code")) != 2) {
1004 setEventMessages($langs->transnoentities(
"ErrorCountryCodeMustBe2Char", $langs->transnoentities(
"Code")),
null,
'errors');
1006 if ($id == DICT_PAIEMENT && strlen(
GETPOST(
"code")) >= 6) {
1008 setEventMessages($langs->transnoentities(
"ErrorFieldMustHaveLessThanXChar", $langs->transnoentities(
"Code"),
'6'),
null,
'errors');
1013 $_POST[
"localtax1"] =
'0';
1016 $_POST[
"localtax2"] =
'0';
1018 if (
GETPOST(
'department_buyer_id') <= 0) {
1019 $_POST[
'department_buyer_id'] =
'';
1021 if (
GETPOST(
"accountancy_code") <= 0) {
1022 $_POST[
"accountancy_code"] =
'';
1024 if (
GETPOST(
"accountancy_code_sell") <= 0) {
1025 $_POST[
"accountancy_code_sell"] =
'';
1027 if (
GETPOST(
"accountancy_code_buy") <= 0) {
1028 $_POST[
"accountancy_code_buy"] =
'';
1031 $_POST[
"code"] = preg_replace(
'/[^a-zA-Z0-9_\-\+]/',
'',
GETPOST(
"code"));
1034 $tablename = $tabname[
$id];
1035 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1038 if ($ok &&
GETPOST(
'actionadd')) {
1040 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1042 $sql =
"SELECT MAX(".$tabrowid[
$id].
") as newid FROM ".MAIN_DB_PREFIX.$db->sanitize($tablename);
1043 $result = $db->query($sql);
1045 $obj = $db->fetch_object($result);
1046 $newid = ((int) $obj->newid) + 1;
1048 dol_print_error($db);
1053 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" (";
1055 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1056 $sql .= $tabrowid[
$id].
",";
1058 $sql .= $tabfieldinsert[
$id];
1063 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1064 $sql .= ((int) $newid).
",";
1067 foreach ($listfieldinsert as $f => $value) {
1068 $keycode = (isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
'');
1069 if (empty($keycode)) {
1073 if ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
1075 } elseif ($value ==
'taux' || $value ==
'localtax1') {
1077 } elseif ($value ==
'entity') {
1078 $_POST[$keycode] = (int)
getEntity($tablename, 0);
1085 if ($keycode ==
'sortorder') {
1087 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == DICT_TVA)) {
1089 } elseif ($keycode ==
'content') {
1090 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
1091 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
1094 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
1102 $resql = $db->query($sql);
1104 setEventMessages($langs->transnoentities(
"RecordCreatedSuccessfully"),
null,
'mesgs');
1108 if ($db->type ==
'pgsql' && $tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1109 $db->query(
"SELECT setval(pg_get_serial_sequence('".$db->escape(MAIN_DB_PREFIX.$db->sanitize($tablename)).
"', '".$db->escape($tabrowid[$id]).
"'), GREATEST((SELECT MAX(".$db->sanitize($tabrowid[$id]).
") FROM ".MAIN_DB_PREFIX.$db->sanitize($tablename).
"), 1))");
1113 if ($id == DICT_TVA &&
GETPOSTINT(
'country') > 0) {
1116 $_POST = array(
'id' => $id);
1118 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
1119 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
1121 dol_print_error($db);
1127 if ($ok &&
GETPOST(
'actionmodify')) {
1128 if ($tabrowid[$id]) {
1129 $rowidcol = $tabrowid[
$id];
1131 $rowidcol =
"rowid";
1135 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET ";
1137 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
1138 $sql .= $tabrowid[
$id].
"=";
1139 $sql .=
"'".$db->escape($rowid).
"', ";
1142 foreach ($listfieldmodify as $field) {
1143 $keycode = empty($listfieldvalue[$i]) ?
'' : $listfieldvalue[$i];
1144 if (empty($keycode)) {
1148 if ($field ==
'price' || preg_match(
'/^amount/i', $field)) {
1150 } elseif ($field ==
'taux' || $field ==
'localtax1') {
1152 } elseif ($field ==
'entity') {
1153 $_POST[$keycode] = (int)
getEntity($tablename, 0);
1160 if ($keycode ==
'sortorder') {
1162 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == DICT_TVA)) {
1164 } elseif ($keycode ==
'content') {
1165 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
1166 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
1169 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
1174 if (in_array($rowidcol, array(
'code',
'code_iso'))) {
1175 $sql .=
" WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'";
1177 $sql .=
" WHERE ".$db->sanitize($rowidcol).
" = ".((int) $rowid);
1179 if (in_array(
'entity', $listfieldmodify)) {
1180 $sql .=
" AND entity = ".((int)
getEntity($tablename, 0));
1185 $resql = $db->query($sql);
1187 setEventMessages($db->error(),
null,
'errors');
1191 if (!$ok &&
GETPOST(
'actionadd')) {
1194 if (!$ok &&
GETPOST(
'actionmodify')) {
1199 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
1200 if ($tabrowid[$id]) {
1201 $rowidcol = $tabrowid[
$id];
1203 $rowidcol =
"rowid";
1206 $tablename = $tabname[
$id];
1207 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1209 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1212 $result = $db->query($sql);
1214 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
1215 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
1217 dol_print_error($db);
1223 if ($action == $acts[0]) {
1224 if ($tabrowid[$id]) {
1225 $rowidcol = $tabrowid[
$id];
1227 $rowidcol =
"rowid";
1230 $tablename = $tabname[
$id];
1231 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1234 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 1 WHERE ".$db->sanitize($rowidcol).
" = ".((int) $rowid).($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1236 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1241 if ($sql !==
null) {
1242 $result = $db->query($sql);
1244 dol_print_error($db);
1247 dol_print_error(
null,
"No DB entry or no code");
1252 if ($action == $acts[1]) {
1253 if ($tabrowid[$id]) {
1254 $rowidcol = $tabrowid[
$id];
1256 $rowidcol =
"rowid";
1259 $tablename = $tabname[
$id];
1260 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1263 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1265 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1270 if ($sql !==
null) {
1271 $result = $db->query($sql);
1273 dol_print_error($db);
1276 dol_print_error(
null,
"No DB entry or no code");
1281 if ($action ==
'activate_favorite') {
1282 if ($tabrowid[$id]) {
1283 $rowidcol = $tabrowid[
$id];
1285 $rowidcol =
"rowid";
1288 $tablename = $tabname[
$id];
1289 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1292 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 1 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1294 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1299 if ($sql !==
null) {
1300 $result = $db->query($sql);
1302 dol_print_error($db);
1305 dol_print_error(
null,
"No DB entry or no code");
1310 if ($action ==
'disable_favorite') {
1311 if ($tabrowid[$id]) {
1312 $rowidcol = $tabrowid[
$id];
1314 $rowidcol =
"rowid";
1317 $tablename = $tabname[
$id];
1318 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1321 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1323 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1328 if ($sql !==
null) {
1329 $result = $db->query($sql);
1331 dol_print_error($db);
1334 dol_print_error(
null,
"No DB entry or no code");
1339 if ($action ==
'activate_eec') {
1340 if ($tabrowid[$id]) {
1341 $rowidcol = $tabrowid[
$id];
1343 $rowidcol =
"rowid";
1346 $tablename = $tabname[
$id];
1347 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1350 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 1 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1352 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1357 if ($sql !==
null) {
1358 $result = $db->query($sql);
1360 dol_print_error($db);
1363 dol_print_error(
null,
"No DB entry or no code");
1368 if ($action ==
'disable_eec') {
1369 if ($tabrowid[$id]) {
1370 $rowidcol = $tabrowid[
$id];
1372 $rowidcol =
"rowid";
1375 $tablename = $tabname[
$id];
1376 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1379 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1381 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1386 if ($sql !==
null) {
1387 $result = $db->query($sql);
1389 dol_print_error($db);
1392 dol_print_error(
null,
"No DB entry or no code");
1397 if ($action ==
'activate_sepa') {
1398 if ($tabrowid[$id]) {
1399 $rowidcol = $tabrowid[
$id];
1401 $rowidcol =
"rowid";
1404 $tablename = $tabname[
$id];
1405 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1408 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 1 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1410 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1415 if ($sql !==
null) {
1416 $result = $db->query($sql);
1418 dol_print_error($db);
1421 dol_print_error(
null,
"No DB entry or no code");
1426 if ($action ==
'disable_sepa') {
1427 if ($tabrowid[$id]) {
1428 $rowidcol = $tabrowid[
$id];
1430 $rowidcol =
"rowid";
1433 $tablename = $tabname[
$id];
1434 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1437 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1439 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1444 if ($sql !==
null) {
1445 $result = $db->query($sql);
1447 dol_print_error($db);
1450 dol_print_error(
null,
"No DB entry or no code");
1459global $form, $formother;
1461$form =
new Form($db);
1464$title = $langs->trans(
"DictionarySetup");
1466llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-dict');
1468if (
GETPOSTINT(
'id') == DICT_SOCIALNETWORKS && $from ==
'socialnetworksetup') {
1469 $head = socialnetwork_prepare_head();
1475if ($id && empty($from)) {
1476 $title .=
' - '.$langs->trans($tablib[$id]);
1477 $linkback =
'<a href="'.$_SERVER[
'PHP_SELF'].
'">'.img_picto($langs->trans(
"BackToDictionaryList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToDictionaryList").
'</span></a>';
1479$titlepicto =
'title_setup';
1480if ($id == DICT_TVA &&
GETPOST(
'from') ==
'accountancy') {
1481 $title = $langs->trans(
"MenuVatAccounts");
1482 $titlepicto =
'accountancy';
1484if ($id == DICT_CHARGESOCIALES &&
GETPOST(
'from') ==
'accountancy') {
1485 $title = $langs->trans(
"MenuTaxAccounts");
1486 $titlepicto =
'accountancy';
1489$param =
'&id='.urlencode((
string) ($id));
1490if ($search_country_id ||
GETPOSTISSET(
'page') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha')) {
1491 $param .=
'&search_country_id='.urlencode((
string) ($search_country_id ? $search_country_id : -1));
1493if ($search_code !=
'') {
1494 $param .=
'&search_code='.urlencode($search_code);
1496if ($search_active !=
'') {
1497 $param .=
'&search_active='.urlencode($search_active);
1500 $param .=
'&entity='.(int) $entity;
1503 $param .=
'&from='.urlencode($from);
1505$paramwithsearch = $param;
1507 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
1510 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
1513 $paramwithsearch .=
'&from='.urlencode($from);
1518if ($action ==
'delete') {
1519 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'rowid='.urlencode($rowid).
'&code='.urlencode($code).$paramwithsearch, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
1525 $sqlfields = $tabsql[
$id];
1527 $tablecode =
't.code';
1529 $tableprefixarray = array(
1530 DICT_FORME_JURIDIQUE =>
'f.code',
1531 DICT_DEPARTEMENTS =>
'd.code_departement',
1532 DICT_REGIONS =>
'r.code_region',
1533 DICT_COUNTRY =>
'c.code',
1534 DICT_CIVILITY =>
'c.code',
1535 DICT_ACTIONCOMM =>
'a.code',
1536 DICT_CHARGESOCIALES =>
'a.code',
1537 DICT_TYPENT =>
't.code',
1538 DICT_CURRENCIES =>
'c.code_iso',
1539 DICT_ECOTAXE =>
'e.code',
1540 DICT_HOLIDAY_TYPES =>
'h.code',
1541 DICT_HRM_PUBLIC_HOLIDAY =>
'a.code',
1542 DICT_UNITS =>
'r.code',
1543 DICT_SOCIALNETWORKS =>
's.code',
1549 if (!empty($tableprefixarray[$id])) {
1550 $tablecode = $tableprefixarray[
$id];
1551 $tableprefix = preg_replace(
'/\..*$/',
'.', $tablecode);
1554 if (empty($tableprefix) && preg_match(
'/SELECT ([a-z]\.)rowid/i', $sqlfields, $reg)) {
1555 $tableprefix = $reg[1];
1559 if (!preg_match(
'/ WHERE /', $sql)) {
1560 $sql .=
" WHERE 1 = 1";
1562 if ($search_country_id > 0) {
1563 if ($id == DICT_HRM_PUBLIC_HOLIDAY || $id == DICT_HOLIDAY_TYPES) {
1564 $sql .=
" AND (c.rowid IS NULL OR c.rowid = 0 OR c.rowid = ".((int) $search_country_id).
")";
1566 $sql .=
" AND c.rowid = ".((int) $search_country_id);
1569 if ($search_code !=
'') {
1572 if ($search_active ==
'yes') {
1573 $sql .=
" AND ".$db->sanitize($tableprefix).
"active = 1";
1574 } elseif ($search_active ==
'no') {
1575 $sql .=
" AND ".$db->sanitize($tableprefix).
"active = 0";
1579 $nbtotalofrecords =
'';
1582 $sqlforcount = preg_replace(
'/^.*\sFROM\s/',
'SELECT COUNT(*) as nbtotalofrecords FROM ', $sql);
1583 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1584 $resql = $db->query($sqlforcount);
1586 $objforcount = $db->fetch_object($resql);
1587 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1589 dol_print_error($db);
1592 if (($page * $listlimit) > $nbtotalofrecords) {
1601 if ($sortfield ==
'country') {
1602 $sortfield =
'country_code';
1604 $sql .= $db->order($sortfield, $sortorder);
1607 $tabsqlsort[
$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
' '.$sortorder.
',/i',
'', $tabsqlsort[$id]);
1608 $tabsqlsort[
$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
',/i',
'', $tabsqlsort[$id]);
1610 $sql .=
" ORDER BY ";
1612 $sql .= $tabsqlsort[
$id];
1614 $sql .= $db->plimit($listlimit + 1, $offset);
1618 if (empty($tabfield[$id])) {
1619 dol_print_error($db,
'The table with id '.
$id.
' has no array tabfield defined');
1622 $fieldlist = explode(
',', $tabfield[$id]);
1627 $arrayfields = array();
1628 $mainfieldlist = explode(
',', str_replace(
' ',
'', empty($tabfieldmain[$id]) ? $tabfield[$id] : $tabfieldmain[
$id]));
1629 foreach ($fieldlist as $key => $value) {
1630 if (empty($value) || in_array($value, array(
'entity',
'region_id',
'country_id',
'department_buyer_id'))) {
1633 $arrayfields[$value] = array(
1635 'checked' => (in_array($value, $mainfieldlist) ? 1 : 0),
1636 'position' => (int) $key
1640 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST" spellcheck="false">';
1641 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1642 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag($from).
'">';
1643 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1647 print
info_admin($langs->trans(
"VATIsUsedIsOff", $langs->transnoentities(
"Setup"), $langs->transnoentities(
"CompanyFoundation")));
1654 $resql = $db->query($sql);
1656 $num = $db->num_rows($resql);
1659 $massactionbutton = $linkback;
1661 $newcardbutton =
'';
1666 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/admin/dict.php?action=create'.$param.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
1668 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'tools', 0, $newcardbutton,
'', $listlimit,
'listlimit', 0, 1);
1671 if ($action ==
'create') {
1673 if ($tabname[$id]) {
1676 $fieldlist = explode(
',', $tabfield[$id]);
1678 print
'<div class="div-table-responsive-no-min">';
1679 print
'<table class="noborder centpercent">';
1682 print
'<!-- line title to add new entry -->';
1683 $tdsoffields =
'<tr class="liste_titre">';
1684 foreach ($fieldlist as $field => $value) {
1685 if ($value ==
'entity') {
1686 $withentity = (int)
getEntity($tabname[$id], 0);
1691 $valuetoshow = ucfirst($value);
1692 $valuetoshow = $langs->trans($valuetoshow);
1695 if ($value ==
'pos') {
1696 $valuetoshow = $langs->trans(
"Position");
1699 if ($value ==
'source') {
1700 $valuetoshow = $langs->trans(
"Contact");
1702 if ($value ==
'price') {
1703 $valuetoshow = $langs->trans(
"PriceUHT");
1705 if ($value ==
'taux') {
1706 if ($tabname[$id] !=
"c_revenuestamp") {
1707 $valuetoshow = $langs->trans(
"Rate");
1709 $valuetoshow = $langs->trans(
"Amount");
1713 if ($value ==
'localtax1_type') {
1714 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2";
1718 if ($value ==
'localtax1') {
1719 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2');
1720 $class =
"center minwidth75";
1722 if ($value ==
'localtax2_type') {
1723 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3";
1727 if ($value ==
'localtax2') {
1728 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3');
1729 $class =
"center minwidth75";
1731 if ($value ==
'type_vat') {
1732 $valuetoshow = $langs->trans(
"VATType");
1734 if ($value ==
'organization') {
1735 $valuetoshow = $langs->trans(
"Organization");
1737 if ($value ==
'lang') {
1738 $valuetoshow = $langs->trans(
"Language");
1740 if ($value ==
'type') {
1741 if ($tabname[$id] ==
"c_paiement") {
1742 $valuetoshow = $form->textwithtooltip($langs->trans(
"Type"), $langs->trans(
"TypePaymentDesc"), 2, 1, img_help(1,
''));
1744 $valuetoshow = $langs->trans(
"Type");
1747 if ($value ==
'code') {
1748 $valuetoshow = $langs->trans(
"Code");
1749 $class =
'maxwidth100';
1751 if ($value ==
'libelle' || $value ==
'label') {
1752 $valuetoshow = $form->textwithtooltip($langs->trans(
"Label"), $langs->trans(
"LabelUsedByDefault"), 2, 1, img_help(1,
''));
1754 if ($value ==
'libelle_facture') {
1755 $valuetoshow = $form->textwithtooltip($langs->trans(
"LabelOnDocuments"), $langs->trans(
"LabelUsedByDefault"), 2, 1, img_help(1,
''));
1757 if ($value ==
'deposit_percent') {
1758 $valuetoshow = $langs->trans(
'DepositPercent');
1761 if ($value ==
'country') {
1762 if (in_array(
'region_id', $fieldlist)) {
1766 $valuetoshow = $langs->trans(
"Country");
1768 if ($value ==
'department_buyer') {
1771 if ($value ==
'recuperableonly') {
1772 $valuetoshow = $langs->trans(
"NPR");
1775 if ($value ==
'einvoice_vatex') {
1776 $valuetoshow = $langs->trans(
"VATExemptionCode");
1779 if ($value ==
'nbjour') {
1780 $valuetoshow = $langs->trans(
"NbOfDays");
1783 if ($value ==
'type_cdr') {
1784 $valuetoshow = $langs->trans(
"AtEndOfMonth");
1787 if ($value ==
'decalage') {
1788 $valuetoshow = $langs->trans(
"Offset");
1791 if ($value ==
'width' || $value ==
'nx') {
1792 $valuetoshow = $langs->trans(
"Width");
1794 if ($value ==
'height' || $value ==
'ny') {
1795 $valuetoshow = $langs->trans(
"Height");
1797 if ($value ==
'unit' || $value ==
'metric') {
1798 $valuetoshow = $langs->trans(
"MeasuringUnit");
1800 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
1803 if ($value ==
'accountancy_code') {
1804 $valuetoshow = $langs->trans(
"AccountancyCode");
1806 if ($value ==
'accountancy_code_sell') {
1807 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
1809 if ($value ==
'accountancy_code_buy') {
1810 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
1812 if ($value ==
'pcg_version' || $value ==
'fk_pcg_version') {
1813 $valuetoshow = $langs->trans(
"Pcg_version");
1815 if ($value ==
'account_parent') {
1816 $valuetoshow = $langs->trans(
"Accountparent");
1818 if ($value ==
'pcg_type') {
1819 $valuetoshow = $langs->trans(
"Pcg_type");
1821 if ($value ==
'pcg_subtype') {
1822 $valuetoshow = $langs->trans(
"Pcg_subtype");
1824 if ($value ==
'sortorder') {
1825 $valuetoshow = $langs->trans(
"SortOrder");
1828 if ($value ==
'short_label') {
1829 $valuetoshow = $langs->trans(
"ShortLabel");
1831 if ($value ==
'fk_parent') {
1832 $valuetoshow = $langs->trans(
"ParentID");
1835 if ($value ==
'range_account') {
1836 $valuetoshow = $langs->trans(
"Range");
1838 if ($value ==
'sens') {
1839 $valuetoshow = $langs->trans(
"Sens");
1841 if ($value ==
'category_type') {
1842 $valuetoshow = $langs->trans(
"Calculated");
1844 if ($value ==
'formula') {
1845 $valuetoshow = $langs->trans(
"Formula");
1847 if ($value ==
'paper_size') {
1848 $valuetoshow = $langs->trans(
"PaperSize");
1850 if ($value ==
'orientation') {
1851 $valuetoshow = $langs->trans(
"Orientation");
1853 if ($value ==
'leftmargin') {
1854 $valuetoshow = $langs->trans(
"LeftMargin");
1856 if ($value ==
'topmargin') {
1857 $valuetoshow = $langs->trans(
"TopMargin");
1859 if ($value ==
'spacex') {
1860 $valuetoshow = $langs->trans(
"SpaceX");
1862 if ($value ==
'spacey') {
1863 $valuetoshow = $langs->trans(
"SpaceY");
1865 if ($value ==
'font_size') {
1866 $valuetoshow = $langs->trans(
"FontSize");
1868 if ($value ==
'custom_x') {
1869 $valuetoshow = $langs->trans(
"CustomX");
1871 if ($value ==
'custom_y') {
1872 $valuetoshow = $langs->trans(
"CustomY");
1874 if ($value ==
'percent') {
1875 $valuetoshow = $langs->trans(
"Percentage");
1877 if ($value ==
'affect') {
1878 $valuetoshow = $langs->trans(
"WithCounter");
1880 if ($value ==
'delay') {
1881 $valuetoshow = $langs->trans(
"NoticePeriod");
1883 if ($value ==
'newbymonth') {
1884 $valuetoshow = $langs->trans(
"NewByMonth");
1886 if ($value ==
'fk_tva') {
1887 $valuetoshow = $langs->trans(
"VAT");
1889 if ($value ==
'range_ik') {
1890 $valuetoshow = $langs->trans(
"RangeIk");
1892 if ($value ==
'fk_c_exp_tax_cat') {
1893 $valuetoshow = $langs->trans(
"CarCategory");
1895 if ($value ==
'revenuestamp_type') {
1896 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
1898 if ($value ==
'use_default') {
1899 $valuetoshow = $langs->trans(
'Default');
1902 if ($value ==
'unit_type') {
1903 $valuetoshow = $langs->trans(
'TypeOfUnit');
1905 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
1906 $valuetoshow = $langs->trans(
'TicketGroupIsPublic');
1909 if ($value ==
'block_if_negative') {
1910 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
1912 if ($value ==
'type_duration') {
1913 $valuetoshow = $langs->trans(
'Unit');
1916 if ($id == DICT_DEPARTEMENTS) {
1917 if ($value ==
'region_id') {
1918 $valuetoshow =
' ';
1921 if ($value ==
'region') {
1922 $valuetoshow = $langs->trans(
"Country").
'/'.$langs->trans(
"Region");
1927 if ($valuetoshow !=
'') {
1928 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[
$id]][
'help'][$value] :
'');
1930 $tdsoffields .=
'<th'.($class ?
' class="'.$class.
'"' :
'').
'>';
1931 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
1932 $tdsoffields .=
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.img_help(1, $valuetoshow).
'</a>';
1933 } elseif ($tooltiphelp) {
1934 $tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
1936 $tdsoffields .= $valuetoshow;
1938 $tdsoffields .=
'</th>';
1942 if ($id == DICT_COUNTRY) {
1943 $tdsoffields .=
'<th></th>';
1944 $tdsoffields .=
'<th></th>';
1946 $tdsoffields .=
'<th>';
1947 $tdsoffields .=
'<input type="hidden" name="id" value="'.$id.
'">';
1948 if (!is_null($withentity)) {
1949 $tdsoffields .=
'<input type="hidden" name="entity" value="'.$withentity.
'">';
1951 $tdsoffields .=
'</th>';
1952 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1953 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1954 $tdsoffields .=
'</tr>';
1960 print
'<!-- line input to add new entry -->';
1961 print
'<tr class="oddeven nodrag nodrop nohover">';
1966 foreach ($fieldlist as $key => $val) {
1973 $tmpaction =
'create';
1974 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
1975 $reshook = $hookmanager->executeHooks(
'createDictionaryFieldlist', $parameters, $obj, $tmpaction);
1976 $error = $hookmanager->error;
1977 $errors = $hookmanager->errors;
1979 if ($id == DICT_REGIONS) {
1980 unset($fieldlist[2]);
1983 if (empty($reshook)) {
1987 if ($id == DICT_COUNTRY) {
1992 print
'<td colspan="3" class="center">';
1993 if ($action !=
'edit') {
1994 print
'<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans(
"Add").
'">';
1996 print
'<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans(
"Add").
'">';
2008 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST" spellcheck="false">';
2009 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2010 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
2011 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
2016 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $contextpage,
$conf->main_checkbox_left_column, 0);
2019 foreach ($fieldlist as $field => $value) {
2020 if ($value ==
'entity') {
2025 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2028 if (empty($arrayfields[$value][
'checked'])) {
2033 if ($value ==
'country') {
2035 } elseif ($value ==
'code') {
2041 print
'<div class="div-table-responsive">';
2042 print
'<table class="noborder centpercent noborder">';
2047 print
'<!-- line title to search record -->'.
"\n";
2048 print
'<tr class="liste_titre_filter">';
2051 if (
$conf->main_checkbox_left_column) {
2052 print
'<td class="liste_titre center maxwidthsearch">';
2054 $searchpicto = $form->showFilterAndCheckAddButtons(0);
2061 foreach ($fieldlist as $field => $value) {
2062 if ($value ==
'entity') {
2067 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2070 if (empty($arrayfields[$value][
'checked'])) {
2075 if ($value ==
'country') {
2076 print
'<td class="liste_titre">';
2077 print $form->select_country($search_country_id,
'search_country_id',
'', 28,
'minwidth100 maxwidth150 maxwidthonsmartphone',
'',
' ');
2080 } elseif ($value ==
'code') {
2081 print
'<td class="liste_titre">';
2082 print
'<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).
'">';
2085 } elseif ($value ==
'type_vat') {
2086 print
'<td class="liste_titre">';
2087 print $form->selectarray(
'search_'.$value, $type_vatList, (empty($obj->{$value}) ?
'' : $obj->{$value}), 1);
2091 print
'<td class="liste_titre">';
2097 if ($id == DICT_COUNTRY) {
2107 print
'<td class="liste_titre center parentonrightofpage">';
2108 print $form->selectyesno(
'search_active', $search_active, 0,
false, 1, 1,
'maxwidth100 onrightofpage',
'Activated',
'Disabled');
2113 if (!
$conf->main_checkbox_left_column) {
2114 print
'<td class="liste_titre center maxwidthsearch">';
2116 $searchpicto = $form->showFilterAndCheckAddButtons(0);
2127 print
'<!-- line title of record -->'.
"\n";
2128 print
'<tr class="liste_titre">';
2131 if (
$conf->main_checkbox_left_column) {
2132 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'', ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center maxwidthsearch ');
2135 foreach ($fieldlist as $field => $value) {
2136 if ($value ==
'entity') {
2140 if (in_array($value, array(
'label',
'libelle',
'libelle_facture')) && empty($tabcomplete[$tabname[$id]][
'help'][$value])) {
2141 if (!isset($tabcomplete[$tabname[$id]][
'help']) || !is_array($tabcomplete[$tabname[$id]][
'help'])) {
2142 $tabcomplete[$tabname[
$id]][
'help'] = array();
2144 $tabcomplete[$tabname[
$id]][
'help'][$value] = $langs->trans(
'LabelUsedByDefault');
2152 $valuetoshow =
dictFieldLabel($value, $tabname[$id], $tablib[$id]);
2155 if ($value ==
'taux') {
2156 $cssprefix =
'center ';
2158 if (in_array($value, array(
'type_vat',
'localtax1_type',
'localtax1',
'localtax2_type',
'localtax2'))) {
2159 $cssprefix =
"center minwidth75 ";
2162 if (in_array($value, array(
'pos',
'position',
'deposit_percent',
'nbjour',
'decalage'))) {
2163 $cssprefix =
'right ';
2165 if ($value ==
'recuperableonly') {
2166 $cssprefix =
"center ";
2168 if ($value ==
'einvoice_vatex') {
2169 $cssprefix =
"center";
2171 if ($value ==
'type_cdr') {
2172 $cssprefix =
"center ";
2174 if ($value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2177 if (in_array($value, array(
'sortorder',
'fk_parent',
'use_default'))) {
2178 $cssprefix =
'center ';
2180 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
2181 $cssprefix =
'center ';
2184 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2187 if (empty($arrayfields[$value][
'checked'])) {
2193 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[
$id]][
'help'][$value] :
'');
2195 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
2196 $newvaluetoshow =
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.img_help(1, $valuetoshow).
'</a>';
2197 } elseif ($tooltiphelp) {
2198 $newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp);
2200 $newvaluetoshow = $valuetoshow;
2203 print
getTitleFieldOfList($newvaluetoshow, 0, $_SERVER[
"PHP_SELF"], ($sortable ? $value :
''), ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $cssprefix);
2207 if ($id == DICT_COUNTRY) {
2208 print
getTitleFieldOfList($langs->trans(
"InEEC"), 0, $_SERVER[
"PHP_SELF"],
"eec", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
"CountryIsInEEC"));
2209 print
getTitleFieldOfList($langs->trans(
"InSepa"), 0, $_SERVER[
"PHP_SELF"],
"sepa", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
"CountryIsInSepa"));
2210 print
getTitleFieldOfList($langs->trans(
"Favorite"), 0, $_SERVER[
"PHP_SELF"],
"favorite", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
2214 print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
2217 if (!
$conf->main_checkbox_left_column) {
2225 print
'<!-- lines of dict -->'.
"\n";
2227 $obj = $db->fetch_object($resql);
2232 $withentity = (isset($obj->entity) ? (int) $obj->entity : null);
2235 if ($id == DICT_COUNTRY) {
2236 if ($obj->code ==
'') {
2246 if (isset($obj->code) && !in_array($id, array(DICT_TVA, DICT_PRODUCT_NATURE))) {
2247 if (($obj->code ==
'0' || $obj->code ==
'' || preg_match(
'/unknown/i', $obj->code))) {
2250 } elseif ($obj->code ==
'RECEP') {
2253 } elseif ($obj->code ==
'EF0') {
2258 if ($id == DICT_TYPE_CONTAINER && $obj->module ==
'system') {
2261 if (in_array($obj->code, array(
'banner'))) {
2265 if (isset($obj->type) && in_array($obj->type, array(
'system',
'systemauto'))) {
2268 if (in_array(empty($obj->code) ?
'' : $obj->code, array(
'AC_OTH',
'AC_OTH_AUTO')) || in_array(empty($obj->
type) ?
'' : $obj->
type, array(
'systemauto'))) {
2272 $canbemodified = $iserasable;
2274 if (!empty($obj->code) && $obj->code ==
'RECEP') {
2277 if ($tabname[$id] ==
"c_actioncomm") {
2281 if ($tabname[$id] ==
"c_product_nature" && in_array($obj->code, array(0, 1))) {
2293 if (!is_null($withentity) && $withentity != (
int)
getEntity($tabname[$id], 0)) {
2299 $rowidcol = empty($tabrowid[$id]) ?
'rowid' : $tabrowid[
$id];
2301 if (empty($rowidcol) || in_array($id, array(DICT_ACTIONCOMM, DICT_CHARGESOCIALES, DICT_TYPENT, DICT_PAIEMENT, DICT_TYPE_FEES, DICT_EFFECTIF, DICT_STCOMM, DICT_HRM_PUBLIC_HOLIDAY))) {
2302 $rowidcol =
'rowid';
2304 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder);
2305 $url .=
'&rowid='.(isset($obj->$rowidcol) ? ((int) $obj->$rowidcol) : (!empty($obj->code) ? urlencode($obj->code) :
''));
2306 $url .=
'&code='.(!empty($obj->code) ? urlencode($obj->code) :
'');
2307 if (!empty($param)) {
2311 if (!is_null($withentity)) {
2312 $url .=
'&entity='.((int) $withentity);
2318 print
'<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ?
'' : $obj->rowid).
'">';
2321 if (
$conf->main_checkbox_left_column) {
2322 print
'<td class="center maxwidthsearch nowraponall">';
2324 if ($canbemodified) {
2325 print
'<a class="reposition editfielda marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=edit&token='.
newToken().
'">'.img_edit().
'</a>';
2330 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=delete&token='.
newToken().
'">'.img_delete().
'</a>';
2339 if ($action ==
'edit' && ($rowid == (isset($obj->rowid) ? $obj->rowid : $obj->code))) {
2340 $tmpaction =
'edit';
2341 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
2342 $reshook = $hookmanager->executeHooks(
'editDictionaryFieldlist', $parameters, $obj, $tmpaction);
2343 $error = $hookmanager->error;
2344 $errors = $hookmanager->errors;
2347 if (empty($reshook)) {
2348 $withentity =
dictFieldList($fieldlist, $obj, $tabname[$id],
'edit');
2351 print
'<td colspan="3" class="center">';
2352 print
'<div name="'.(isset($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
2353 print
'<input type="hidden" name="page" value="'.((int) $page).
'">';
2354 print
'<input type="hidden" name="rowid" value="'.dol_escape_htmltag($rowid).
'">';
2355 if (!is_null($withentity)) {
2356 print
'<input type="hidden" name="entity" value="'.$withentity.
'">';
2358 print
'<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
2359 print
'<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
2362 $tmpaction =
'view';
2363 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
2364 $reshook = $hookmanager->executeHooks(
'viewDictionaryFieldlist', $parameters, $obj, $tmpaction);
2366 $error = $hookmanager->error;
2367 $errors = $hookmanager->errors;
2369 $langs->loadLangs(array(
"bills",
"agenda",
"propal"));
2371 if (empty($reshook)) {
2373 $TDurationTypes = $form->getDurationTypes($langs);
2375 foreach ($fieldlist as $field => $value) {
2376 $class = (isset($tabcomplete[$tabname[$id]][
'css'][$value]) ? $tabcomplete[$tabname[
$id]][
'css'][$value] :
'');
2378 if (empty($arrayfields[$value][
'checked'])) {
2381 $valuetoshow = (isset($obj->$value) && $obj->$value !==
null && $obj->$value !==
'') ? $obj->$value :
'';
2384 if ($value ==
'entity') {
2385 $withentity = $valuetoshow;
2390 if ($value ==
'code' && $id == DICT_PRODUCT_NATURE) {
2391 $valuetoshow = (int) $valuetoshow;
2392 } elseif ($value ==
'element') {
2393 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
2394 } elseif ($value ==
'source') {
2395 $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
2396 } elseif ($valuetoshow ==
'all') {
2397 $valuetoshow = $langs->trans(
'All');
2398 } elseif ($value ==
'country') {
2399 if (empty($obj->country_code)) {
2402 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
2403 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code) ? $obj->country_code.
" - ".$key : $obj->country);
2405 } elseif ($value ==
'recuperableonly' || $value ==
'deductible' || $value ==
'category_type') {
2406 $valuetoshow = yn($valuetoshow ? 1 : 0);
2408 } elseif ($value ==
'type_cdr') {
2409 if (empty($valuetoshow)) {
2410 $valuetoshow = $langs->trans(
'None');
2411 } elseif ($valuetoshow == 1) {
2412 $valuetoshow = $langs->trans(
'AtEndOfMonth');
2413 } elseif ($valuetoshow == 2) {
2414 $valuetoshow = $langs->trans(
'CurrentNext');
2416 $class =
"center tdoverflowmax125";
2417 } elseif ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
2418 $valuetoshow =
price($valuetoshow);
2420 if (in_array($value, array(
'private',
'joinfile',
'use_default'))) {
2421 if (!empty($valuetoshow)) {
2422 $valuetoshow = img_picto(
'',
'tick');
2426 } elseif ($value ==
'libelle_facture') {
2427 $key = $langs->trans(
"PaymentCondition".strtoupper($obj->code));
2428 $valuetoshow = ($obj->code && $key !=
"PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value);
2429 $valuetoshow = nl2br($valuetoshow);
2430 $titletoshow = $valuetoshow;
2431 $class =
'small tdoverflowmax200';
2432 } elseif ($value ==
'label' && $tabname[$id] ==
'c_country') {
2433 $key = $langs->trans(
"Country".strtoupper($obj->code));
2434 $valuetoshow = ($obj->code && $key !=
"Country".strtoupper($obj->code) ? $key : $obj->$value);
2435 } elseif ($value ==
'label' && $tabname[$id] ==
'c_availability') {
2436 $key = $langs->trans(
"AvailabilityType".strtoupper($obj->code));
2437 $valuetoshow = ($obj->code && $key !=
"AvailabilityType".strtoupper($obj->code) ? $key : $obj->$value);
2438 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_actioncomm') {
2439 $key = $langs->trans(
"Action".strtoupper($obj->code));
2440 $valuetoshow = ($obj->code && $key !=
"Action".strtoupper($obj->code) ? $key : $obj->$value);
2441 } elseif (!empty($obj->code_iso) && $value ==
'label' && $tabname[$id] ==
'c_currencies') {
2442 $key = $langs->trans(
"Currency".strtoupper($obj->code_iso));
2443 $valuetoshow = ( $key !=
"Currency".strtoupper($obj->code_iso) ? $key : $obj->$value);
2444 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_typent') {
2445 $key = $langs->trans(strtoupper($obj->code));
2446 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
2447 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_prospectlevel') {
2448 $key = $langs->trans(strtoupper($obj->code));
2449 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
2450 } elseif ($value ==
'label' && $tabname[$id] ==
'c_civility') {
2451 $key = $langs->trans(
"Civility".strtoupper($obj->code));
2452 $valuetoshow = ($obj->code && $key !=
"Civility".strtoupper($obj->code) ? $key : $obj->$value);
2453 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_type_contact') {
2454 $key = $langs->trans(
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code));
2455 $valuetoshow = ($obj->code && $key !=
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code) ? $key : $obj->$value);
2456 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_payment_term') {
2457 $key = $langs->trans(
"PaymentConditionShort".strtoupper($obj->code));
2458 $valuetoshow = ($obj->code && $key !=
"PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value);
2459 $titletoshow = $key;
2460 $class =
"tdoverflowmax150";
2461 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paiement') {
2462 $key = $langs->trans(
"PaymentType".strtoupper($obj->code));
2463 $valuetoshow = $obj->$value;
2464 if ($obj->code && array_key_exists(
"PaymentType".strtoupper($obj->code), $langs->tab_translate)) {
2465 $htmltext = $form->textwithpicto($langs->trans(
"TranslationFound").
': '.$key, $langs->trans(
"TheTranslationIsSearchedFromKey",
"PaymentType".strtoupper($obj->code)));
2467 $htmltext = $form->textwithpicto($langs->trans(
"TranslationFound").
': '.$langs->trans(
"No"), $langs->trans(
"TheTranslationIsSearchedFromKey",
"PaymentType".strtoupper($obj->code)));
2470 $valuetoshow .=
'<br><span class="opacitymedium small">'.$htmltext.
'</span>';
2471 } elseif ($value ==
'type' && $tabname[$id] ==
'c_paiement') {
2472 $payment_type_list = array(0 => $langs->trans(
'PaymentTypeCustomer'), 1 => $langs->trans(
'PaymentTypeSupplier'), 2 => $langs->trans(
'PaymentTypeBoth'));
2473 $valuetoshow = $payment_type_list[$valuetoshow];
2474 } elseif ($value ==
'label' && $tabname[$id] ==
'c_input_reason') {
2475 $key = $langs->trans(
"DemandReasonType".strtoupper($obj->code));
2476 $valuetoshow = ($obj->code && $key !=
"DemandReasonType".strtoupper($obj->code) ? $key : $obj->$value);
2477 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_input_method') {
2478 $langs->load(
"orders");
2479 $key = $langs->trans($obj->code);
2480 $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->$value;
2481 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_shipment_mode') {
2482 $langs->load(
"sendings");
2483 $key = $langs->trans(
"SendingMethod".strtoupper($obj->code));
2484 $valuetoshow = ($obj->code && $key !=
"SendingMethod".strtoupper($obj->code) ? $key : $obj->$value);
2485 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paper_format') {
2486 $key = $langs->trans(
'PaperFormat'.strtoupper($obj->code));
2487 $valuetoshow = ($obj->code && $key !=
'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$value);
2488 } elseif ($value ==
'label' && $tabname[$id] ==
'c_type_fees') {
2489 $langs->load(
'trips');
2490 $key = $langs->trans(strtoupper($obj->code));
2491 $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$value);
2492 } elseif ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2494 } elseif ($value ==
'unicode') {
2495 $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
2496 } elseif ($value ==
'label' && $tabname[
GETPOSTINT(
"id")] ==
'c_units') {
2497 $langs->load(
"products");
2498 $valuetoshow = $langs->trans($obj->$value);
2499 } elseif ($value ==
'short_label' && $tabname[
GETPOSTINT(
"id")] ==
'c_units') {
2500 $langs->load(
"products");
2501 $valuetoshow = $langs->trans($obj->$value);
2502 } elseif (($value ==
'unit') && ($tabname[$id] ==
'c_paper_format')) {
2503 $key = $langs->trans(
'SizeUnit'.strtolower($obj->unit));
2504 $valuetoshow = ($obj->code && $key !=
'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$value);
2505 } elseif ($value ==
'localtax1' || $value ==
'localtax2') {
2507 } elseif ($value ==
'type_vat') {
2508 $valuetoshow = $type_vatList[(int) $valuetoshow];
2510 } elseif ($value ==
'localtax1_type') {
2511 if ($obj->localtax1 != 0) {
2512 $valuetoshow = $localtax_typeList[$valuetoshow];
2517 } elseif ($value ==
'localtax2_type') {
2518 if ($obj->localtax2 != 0) {
2519 $valuetoshow = $localtax_typeList[$valuetoshow];
2524 } elseif ($value ==
'taux') {
2525 $valuetoshow =
price($valuetoshow, 0, $langs, 0, 0);
2527 } elseif (in_array($value, array(
'recuperableonly'))) {
2529 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2531 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
2533 $tmpaccountingaccount->fetch(0, $valuetoshow, 1);
2534 $titletoshow = $langs->transnoentitiesnoconv(
"Pcgtype").
': '.$tmpaccountingaccount->pcg_type;
2537 } elseif ($value ==
'fk_tva') {
2538 if (empty($form->cache_vatrates)) {
2539 $form->load_tva(
'cache_fk_tva',
'',
$mysoc,
new Societe($db), 0, 0,
'',
false, -1);
2541 foreach ($form->cache_vatrates as $key => $Tab) {
2542 if ($form->cache_vatrates[$key][
'rowid'] == $valuetoshow) {
2543 $valuetoshow = $form->cache_vatrates[$key][
'label'];
2547 } elseif ($value ==
'fk_c_exp_tax_cat') {
2548 $tmpid = $valuetoshow;
2550 $valuetoshow = $langs->trans($valuetoshow ? $valuetoshow : $tmpid);
2551 } elseif ($tabname[$id] ==
'c_exp_tax_cat') {
2552 $valuetoshow = $langs->trans($valuetoshow);
2553 } elseif ($value ==
'libelle' && ($tabname[$id] ==
'c_stcomm' || $tabname[$id] ==
'c_stcommcontact')) {
2554 $key =
'StatusProspect'.$obj->rowid;
2555 $trans = $langs->trans($key);
2556 $valuetoshow = ($trans != $key ? $trans : $obj->{$value});
2557 } elseif ($value ==
'label' && $tabname[$id] ==
'c_units') {
2558 $langs->load(
'other');
2559 $key = $langs->trans($obj->label);
2560 $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
2561 } elseif ($value ==
'label' && $tabname[$id] ==
'c_product_nature') {
2562 $langs->load(
"products");
2563 $valuetoshow = $langs->trans($obj->{$value});
2564 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] ==
'c_productbatch_qcstatus') {
2565 $langs->load(
"productbatch");
2566 $valuetoshow = $langs->trans($obj->{$value});
2567 } elseif ($value ==
'block_if_negative') {
2568 $valuetoshow = yn($obj->{$value});
2569 } elseif ($value ==
'icon') {
2570 $valuetoshow = $obj->{$value}.
" ".img_picto(
"", preg_replace(
'/^fa-/',
'', $obj->{$value}));
2571 } elseif ($value ==
'type_duration') {
2572 if (!empty($obj->{$value}) && array_key_exists($obj->{$value}, $TDurationTypes)) {
2573 $valuetoshow = $TDurationTypes[$obj->{$value}];
2575 } elseif (in_array($value, array(
'leftmargin',
'topmargin',
'spacex',
'spacey',
'width',
'height',
'custom_x',
'custom_y'))) {
2577 } elseif ($value ==
'type' && $id == DICT_ACTIONCOMM && !empty($obj->module)) {
2578 $titletoshow = $langs->trans(
"Module").
' '.$obj->module;
2579 } elseif ($value ==
'color') {
2580 $valuetoshow = $formother->showColor($obj->{$value},
'');
2585 $class .= ($class ?
' ' :
'').
'tddict';
2586 if ($value ==
'name') {
2587 $class .=
' tdoverflowmax200';
2589 if ($value ==
'note' && $id == DICT_TVA) {
2590 $class .=
' tdoverflowmax200';
2592 if (in_array($value, array($value ==
'tracking'))) {
2593 $class .=
' tdoverflowauto';
2595 if (in_array($value, array(
'nbjour',
'decalage',
'pos',
'position',
'deposit_percent'))) {
2598 if (in_array($value, array(
'icon',
'type_vat',
'localtax1_type',
'localtax2_type'))) {
2599 $class .=
' nowraponall';
2601 if (in_array($value, array(
'use_default',
'fk_parent',
'sortorder',
'public'))) {
2602 $class .=
' center';
2604 if (in_array($value, array(
'localtax1_type',
'localtax2_type',
'note',
'note_public',
'note_private'))) {
2609 if (empty($titletoshow) && preg_match(
'/tdoverflow/', $class)) {
2610 $titletoshow = $valuetoshow;
2615 print
'<!-- field value '. $value .
' --><td class="'.$class.
'"'.($titletoshow ?
' title="'.dolPrintHTMLForAttribute($titletoshow).
'"' :
'').
'>'.$valuetoshow.
'</td>';
2621 if ($id == DICT_COUNTRY) {
2622 print
'<td class="nowraponall center">';
2625 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->eec].
'_eec&token='.
newToken().
'">'.$actl[$obj->eec].
'</a>';
2627 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2630 print
'<td class="nowraponall center">';
2633 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->sepa].
'_sepa&token='.
newToken().
'">'.$actl[$obj->sepa].
'</a>';
2635 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2638 print
'<td class="nowraponall center">';
2641 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->favorite].
'_favorite&token='.
newToken().
'">'.$actl[$obj->favorite].
'</a>';
2643 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2650 print
'<td class="nowraponall center">';
2651 if ($canbedisabled) {
2652 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
2654 if (in_array($obj->code, array(
'AC_OTH',
'AC_OTH_AUTO'))) {
2655 print $langs->trans(
"AlwaysActive");
2656 } elseif (isset($obj->type) && in_array($obj->type, array(
'systemauto')) && empty($obj->active)) {
2657 print $langs->trans(
"Deprecated");
2658 } elseif (isset($obj->type) && in_array($obj->type, array(
'system')) && !empty($obj->active) && $obj->code !=
'AC_OTH') {
2659 print $langs->trans(
"UsedOnlyWithTypeOption");
2661 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2667 if (!
$conf->main_checkbox_left_column) {
2668 print
'<td class="center maxwidthsearch nowraponall">';
2670 if ($canbemodified) {
2671 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.
'action=edit&token='.
newToken().
'">'.img_edit().
'</a>';
2676 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=delete&token='.
newToken().
'">'.img_delete().
'</a>';
2687 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2693 dol_print_error($db);
2703 print
'<span class="opacitymedium">'.$langs->trans(
"DictionaryDesc");
2704 print
" ".$langs->trans(
"OnlyActiveElementsAreShown").
"<br>\n";
2705 print
'</span><br>';
2708 $lastlineisempty =
false;
2710 print
'<div class="div-table-responsive-no-min">';
2711 print
'<table class="noborder centpercent">';
2712 print
'<tr class="liste_titre">';
2713 print
'<td>'.$langs->trans(
"Dictionary").
'</td>';
2715 print
'<td class="hideonsmartphone"></td>';
2718 $showemptyline =
'';
2719 foreach ($taborder as $i) {
2720 if (isset($tabname[$i]) && empty($tabcond[$i])) {
2725 if ($showemptyline) {
2726 print
'<tr class="oddeven"><td></td><td></td><td class="hideonsmartphone"></td></tr>';
2731 $value = $tabname[$i];
2732 print
'<tr class="oddeven"><td class="minwidth200">';
2733 if (!empty($tabcond[$i])) {
2734 $tabnamenoprefix = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabname[$i]);
2735 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i;
2736 if ($i == DICT_CHARGESOCIALES) {
2737 print
'&search_country_id='.$mysoc->country_id;
2740 if (!empty($tabcomplete[$tabnamenoprefix][
'picto'])) {
2741 print img_picto(
'', $tabcomplete[$tabnamenoprefix][
'picto'],
'class="pictofixedwidth paddingrightonly"');
2743 print $langs->trans($tablib[$i]);
2746 print $langs->trans($tablib[$i]);
2750 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i.
'">';
2751 print img_picto(
'Edit',
'edit',
'');
2754 print
'<td class="right hideonsmartphone">';
2755 print $form->textwithpicto(
'', $langs->trans(
"Table").
': '.MAIN_DB_PREFIX.$tabname[$i]);
2758 $lastlineisempty =
false;
2760 if (!$lastlineisempty) {
2762 $lastlineisempty =
true;
2791 $valuetoshow = ucfirst($value);
2792 $valuetoshow = $langs->trans($valuetoshow);
2795 if ($value ==
'source') {
2796 $valuetoshow = $langs->trans(
"Contact");
2798 if ($value ==
'price') {
2799 $valuetoshow = $langs->trans(
"PriceUHT");
2801 if ($value ==
'taux') {
2802 if ($tabname !=
"c_revenuestamp") {
2803 $valuetoshow = $langs->trans(
"Rate");
2805 $valuetoshow = $langs->trans(
"Amount");
2808 if ($value ==
'type_vat') {
2809 $valuetoshow = $langs->trans(
"VATType");
2811 if ($value ==
'localtax1_type') {
2812 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2";
2814 if ($value ==
'localtax1') {
2815 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2');
2817 if ($value ==
'localtax2_type') {
2818 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3";
2820 if ($value ==
'localtax2') {
2821 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3');
2823 if ($value ==
'organization') {
2824 $valuetoshow = $langs->trans(
"Organization");
2826 if ($value ==
'lang') {
2827 $valuetoshow = $langs->trans(
"Language");
2829 if ($value ==
'type') {
2830 $valuetoshow = $langs->trans(
"Type");
2832 if ($value ==
'code') {
2833 $valuetoshow = $langs->trans(
"Code");
2835 if (in_array($value, array(
'pos',
'position'))) {
2836 $valuetoshow = $langs->trans(
"Position");
2838 if ($value ==
'libelle' || $value ==
'label') {
2839 $valuetoshow = $langs->trans(
"Label");
2841 if ($value ==
'libelle_facture') {
2842 $valuetoshow = $langs->trans(
"LabelOnDocuments");
2844 if ($value ==
'deposit_percent') {
2845 $valuetoshow = $langs->trans(
'DepositPercent');
2847 if ($value ==
'country') {
2848 $valuetoshow = $langs->trans(
"Country");
2850 if ($value ==
'phone_code') {
2851 $valuetoshow = $langs->trans(
"PhoneCode");
2853 if ($value ==
'trunk_prefix') {
2854 $valuetoshow = $langs->trans(
"TrunkPrefix");
2856 if ($value ==
'department_buyer') {
2857 $valuetoshow = $langs->trans(
'DepartmentBuyer');
2859 if ($value ==
'recuperableonly') {
2860 $valuetoshow = $langs->trans(
"NPR");
2862 if ($value ==
'einvoice_vatex') {
2863 $valuetoshow = $langs->trans(
"VATExemptionCode");
2865 if ($value ==
'nbjour') {
2866 $valuetoshow = $langs->trans(
"NbOfDays");
2868 if ($value ==
'type_cdr') {
2869 $valuetoshow = $langs->trans(
"AtEndOfMonth");
2871 if ($value ==
'decalage') {
2872 $valuetoshow = $langs->trans(
"Offset");
2874 if ($value ==
'width' || $value ==
'nx') {
2875 $valuetoshow = $langs->trans(
"Width");
2877 if ($value ==
'height' || $value ==
'ny') {
2878 $valuetoshow = $langs->trans(
"Height");
2880 if ($value ==
'unit' || $value ==
'metric') {
2881 $valuetoshow = $langs->trans(
"MeasuringUnit");
2883 if ($value ==
'accountancy_code') {
2884 $valuetoshow = $langs->trans(
"AccountancyCode");
2886 if ($value ==
'accountancy_code_sell') {
2887 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
2889 if ($value ==
'accountancy_code_buy') {
2890 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
2892 if ($value ==
'fk_pcg_version') {
2893 $valuetoshow = $langs->trans(
"Pcg_version");
2895 if ($value ==
'account_parent') {
2896 $valuetoshow = $langs->trans(
"Accountsparent");
2898 if ($value ==
'pcg_type') {
2899 $valuetoshow = $langs->trans(
"Pcg_type");
2901 if ($value ==
'pcg_subtype') {
2902 $valuetoshow = $langs->trans(
"Pcg_subtype");
2904 if ($value ==
'sortorder') {
2905 $valuetoshow = $langs->trans(
"SortOrder");
2907 if ($value ==
'short_label') {
2908 $valuetoshow = $langs->trans(
"ShortLabel");
2910 if ($value ==
'fk_parent') {
2911 $valuetoshow = $langs->trans(
"ParentID");
2913 if ($value ==
'range_account') {
2914 $valuetoshow = $langs->trans(
"Range");
2916 if ($value ==
'sens') {
2917 $valuetoshow = $langs->trans(
"Sens");
2919 if ($value ==
'category_type') {
2920 $valuetoshow = $langs->trans(
"Calculated");
2922 if ($value ==
'formula') {
2923 $valuetoshow = $langs->trans(
"Formula");
2925 if ($value ==
'paper_size') {
2926 $valuetoshow = $langs->trans(
"PaperSize");
2928 if ($value ==
'orientation') {
2929 $valuetoshow = $langs->trans(
"Orientation");
2931 if ($value ==
'leftmargin') {
2932 $valuetoshow = $langs->trans(
"LeftMargin");
2934 if ($value ==
'topmargin') {
2935 $valuetoshow = $langs->trans(
"TopMargin");
2937 if ($value ==
'spacex') {
2938 $valuetoshow = $langs->trans(
"SpaceX");
2940 if ($value ==
'spacey') {
2941 $valuetoshow = $langs->trans(
"SpaceY");
2943 if ($value ==
'font_size') {
2944 $valuetoshow = $langs->trans(
"FontSize");
2946 if ($value ==
'custom_x') {
2947 $valuetoshow = $langs->trans(
"CustomX");
2949 if ($value ==
'custom_y') {
2950 $valuetoshow = $langs->trans(
"CustomY");
2952 if ($value ==
'percent') {
2953 $valuetoshow = $langs->trans(
"Percentage");
2955 if ($value ==
'affect') {
2956 $valuetoshow = $langs->trans(
"WithCounter");
2958 if ($value ==
'delay') {
2959 $valuetoshow = $langs->trans(
"NoticePeriod");
2961 if ($value ==
'newbymonth') {
2962 $valuetoshow = $langs->trans(
"NewByMonth");
2964 if ($value ==
'fk_tva') {
2965 $valuetoshow = $langs->trans(
"VAT");
2967 if ($value ==
'range_ik') {
2968 $valuetoshow = $langs->trans(
"RangeIk");
2970 if ($value ==
'fk_c_exp_tax_cat') {
2971 $valuetoshow = $langs->trans(
"CarCategory");
2973 if ($value ==
'revenuestamp_type') {
2974 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
2976 if ($value ==
'use_default') {
2977 $valuetoshow = $langs->trans(
'Default');
2979 if ($value ==
'unit_type') {
2980 $valuetoshow = $langs->trans(
'TypeOfUnit');
2982 if ($value ==
'public' && $tablib ==
'TicketDictCategory') {
2983 $valuetoshow = $langs->trans(
'TicketGroupIsPublic');
2985 if ($value ==
'block_if_negative') {
2986 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
2988 if ($value ==
'type_duration') {
2989 $valuetoshow = $langs->trans(
'Unit');
2992 return $valuetoshow;
3007 global $langs, $db,
$mysoc;
3008 global $form, $formother;
3010 global $elementList, $sourceList, $localtax_typeList, $type_vatList;
3018 foreach ($fieldlist as $field => $value) {
3019 if ($value ==
'entity' && isset($obj->$value)) {
3020 $withentity = $obj->$value;
3024 if (in_array($value, array(
'code',
'libelle',
'type')) && $tabname ==
"c_actioncomm" && isset($obj->$value) && in_array($obj->type, array(
'system',
'systemauto'))) {
3026 $hidden = (!empty($obj->{$value}) ? $obj->{$value} :
'');
3028 print
'<input type="hidden" name="'. $value .
'" value="'.$hidden.
'">';
3029 print $langs->trans($hidden);
3031 } elseif ($value ==
'country') {
3032 if (in_array(
'region_id', $fieldlist)) {
3039 $selected = (!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country :
''));
3041 $selected =
GETPOST(
'countryidforinsert');
3043 print $form->select_country($selected, $value,
'', 28,
'minwidth100 maxwidth150 maxwidthonsmartphone');
3045 } elseif ($value ==
'country_id') {
3046 if (!in_array(
'country', $fieldlist)) {
3047 $country_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
3048 print
'<td class="tdoverflowmax100">';
3049 print
'<input type="hidden" name="'. $value .
'" value="'.$country_id.
'">';
3052 } elseif ($value ==
'region') {
3054 $formcompany->select_region($region_id,
'region');
3056 } elseif ($value ==
'region_id') {
3057 $region_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
3059 print
'<input type="hidden" name="'. $value .
'" value="'.$region_id.
'">';
3061 } elseif ($value ==
'department_buyer') {
3063 print
'<td class="nowraponall">';
3065 $country_code = (!empty($obj->country_code) ? $obj->country_code :
'');
3066 $department_buyer_id = (!empty($obj->department_buyer_id) ? (int) $obj->department_buyer_id : 0);
3067 if ($country_code !=
'') {
3068 print $formcompany->select_state($department_buyer_id, $country_code,
'department_buyer_id',
'minwidth100 maxwidth150 maxwidthonsmartphone');
3072 } elseif ($value ==
'department_buyer_id') {
3073 if (!in_array(
'department_buyer', $fieldlist)) {
3074 $department_buyer_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
3075 print
'<td class="tdoverflowmax100">';
3076 print
'<input type="hidden" name="'.$value.
'" value="'.$department_buyer_id.
'">';
3079 } elseif ($value ==
'lang') {
3083 } elseif (in_array($value, array(
'element',
'source'))) {
3084 $tmparray = array();
3085 if ($value ==
'element') {
3086 $tmparray = $elementList;
3088 $tmparray = $sourceList;
3091 print $form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value} :
''), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth250');
3093 } elseif (in_array($value, array(
'public',
'use_default'))) {
3095 print
'<td class="center">';
3097 print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} :
''), 1);
3099 } elseif ($value ==
'private') {
3102 print $form->selectyesno(
"private", (!empty($obj->{$value}) ? $obj->{$value} :
''));
3104 } elseif ($value ==
'type' && $tabname ==
"c_actioncomm") {
3105 $type = (!empty($obj->type) ? $obj->type :
'user');
3107 print $type.
'<input type="hidden" name="type" value="'.$type.
'">';
3109 } elseif ($value ==
'type' && $tabname ==
'c_paiement') {
3111 $select_list = array(0 => $langs->trans(
'PaymentTypeCustomer'), 1 => $langs->trans(
'PaymentTypeSupplier'), 2 => $langs->trans(
'PaymentTypeBoth'));
3113 print $form->selectarray($value, $select_list, (isset($obj->{$value}) && $obj->{$value} !==
'' ? $obj->{$value} :
'2'));
3115 } elseif ($value ==
'recuperableonly' || $value ==
'type_cdr' || $value ==
'deductible' || $value ==
'category_type') {
3116 if ($value ==
'type_cdr') {
3117 print
'<td class="center">';
3121 if ($value ==
'type_cdr') {
3122 print $form->selectarray($value, array(0 => $langs->trans(
'None'), 1 => $langs->trans(
'AtEndOfMonth'), 2 => $langs->trans(
'CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value} :
''));
3125 print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} :
''), 1);
3128 } elseif (in_array($value, array(
'nbjour',
'decalage',
'taux',
'localtax1',
'localtax2'))) {
3130 if (in_array($value, array(
'taux',
'localtax1',
'localtax2'))) {
3133 print
'<td class="'.$class.
'">';
3134 print
'<input type="text" class="flat" value="'.(isset($obj->{$value}) ? $obj->{$value} :
'').
'" size="3" name="'. $value .
'">';
3136 } elseif (in_array($value, array(
'libelle_facture',
'content'))) {
3141 if ($tabname ==
'c_payment_term') {
3142 $langs->load(
"bills");
3143 if (isset($obj->code) && !empty($obj->code)) {
3144 $transkey =
"PaymentCondition" . strtoupper($obj->code);
3145 if ($langs->trans($transkey) != $transkey) {
3147 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
3152 print
'<textarea cols="30" rows="'.ROWS_2.
'" class="flat" name="'. $value .
'">'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'</textarea>';
3154 print
'<input type="hidden" name="'. $value .
'" value="'.$transkey.
'">';
3157 } elseif ($value ==
'price' || preg_match(
'/^amount/i', (
string) $value)) {
3158 print
'<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value} :
'')).
'" name="'. $value .
'"></td>';
3159 } elseif ($value ==
'code' && isset($obj->{$value})) {
3161 if ($tabname ==
'c_paiement' && in_array($obj->{$value}, array(
'LIQ',
'CB',
'CHQ',
'VIR'))) {
3163 print
'<input type="hidden" class="flat minwidth75 maxwidth100" value="'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'" name="'. $value .
'">';
3164 print $obj->{$value};
3166 print
'<input type="text" class="flat minwidth75 maxwidth100" value="'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'" name="'. $value .
'">';
3169 } elseif ($value ==
'unit') {
3172 'mm' => $langs->trans(
'SizeUnitmm'),
3173 'cm' => $langs->trans(
'SizeUnitcm'),
3174 'point' => $langs->trans(
'SizeUnitpoint'),
3175 'inch' => $langs->trans(
'SizeUnitinch')
3177 print $form->selectarray(
'unit', $units, (empty($obj->{$value}) ?
'' : $obj->{$value}), 0, 0, 0);
3179 } elseif ($value ==
'type_vat') {
3181 print
'<td class="center">';
3182 print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ?
'0' : $obj->{$value}));
3184 } elseif ($value ==
'localtax1_type' || $value ==
'localtax2_type') {
3186 print
'<td class="center">';
3187 print $form->selectarray($value, $localtax_typeList, (empty($obj->{$value}) ?
'' : $obj->{$value}));
3189 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
3192 $fieldname = $value;
3193 $accountancy_account = (empty($obj->$fieldname) ? 0 : $obj->$fieldname);
3194 print $formaccounting->select_account($accountancy_account,
'.'. $value, 1, array(), 1, 1,
'maxwidth125 maxwidthonsmartphone');
3196 $fieldname = $value;
3197 print
'<input type="text" class="flat minwidth100" value="'.(isset($obj->$fieldname) ? $obj->$fieldname :
'').
'" name="'. $value .
'">';
3200 } elseif ($value ==
'fk_tva') {
3202 print $form->load_tva(
'fk_tva', $obj->taux,
$mysoc,
new Societe($db), 0, 0,
'',
false, -1);
3204 } elseif ($value ==
'fk_c_exp_tax_cat') {
3206 print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
3208 } elseif ($value ==
'fk_range') {
3210 print $form->selectExpenseRanges($obj->fk_range);
3212 } elseif ($value ==
'block_if_negative') {
3214 print $form->selectyesno(
"block_if_negative", (empty($obj->block_if_negative) ?
'' : $obj->block_if_negative), 1);
3216 } elseif ($value ==
'type_duration') {
3218 print $form->selectTypeDuration(
'', (empty($obj->type_duration) ?
'' : $obj->type_duration), [
's',
'i',
'h']);
3220 } elseif ($value ==
'color') {
3222 print $formother->selectColor((empty($obj->{$value}) ?
'' : $obj->{$value}),
'color');
3225 $fieldValue = isset($obj->{$value}) ? $obj->{$value} :
'';
3229 if ($value ==
'sortorder') {
3230 $fieldlist[$field] =
'position';
3233 if ($fieldlist[$field] ==
'code') {
3234 $class =
'maxwidth100';
3236 if (in_array($fieldlist[$field], array(
'deposit_percent'))) {
3238 $class =
'maxwidth50 right';
3240 if (in_array($fieldlist[$field], array(
'pos',
'position'))) {
3242 $class =
'maxwidth50 right';
3244 if (in_array($fieldlist[$field], array(
'dayrule',
'day',
'month',
'year',
'use_default',
'affect',
'delay',
'public',
'sortorder',
'sens',
'category_type',
'fk_parent'))) {
3245 $class =
'maxwidth50 center';
3247 if (in_array($fieldlist[$field], array(
'use_default',
'public',
'fk_parent'))) {
3248 $classtd =
'center';
3250 if (in_array($fieldlist[$field], array(
'libelle',
'label',
'tracking'))) {
3251 $class =
'quatrevingtpercent';
3254 if ($fieldlist[$field] ==
'fk_parent') {
3255 if (empty($fieldValue)) {
3262 if (in_array($fieldlist[$field], array(
'libelle',
'label'))) {
3265 case 'c_email_senderprofile':
3266 case 'c_forme_juridique':
3267 case 'c_holiday_types':
3268 case 'c_payment_term':
3269 case 'c_transport_mode':
3270 $maxlength =
' maxlength="255"';
3272 case 'c_email_templates':
3273 $maxlength =
' maxlength="180"';
3275 case 'c_socialnetworks':
3276 $maxlength =
' maxlength="150"';
3279 $maxlength =
' maxlength="128"';
3283 print
'<td class="'.$classtd.
'">';
3286 if (in_array($fieldlist[$field], array(
'label',
'libelle'))) {
3288 if ($tabname ==
'c_civility' && !empty($obj->code)) {
3289 $transkey =
"Civility".strtoupper($obj->code);
3291 if ($tabname ==
'c_payment_term' && !empty($obj->code)) {
3292 $langs->load(
"bills");
3293 $transkey =
"PaymentConditionShort".strtoupper($obj->code);
3295 if ($transkey && $langs->trans($transkey) != $transkey) {
3297 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
3301 print
'<input type="text" class="flat'.($class ?
' '.$class :
'').
'"'.($maxlength ?
' '.$maxlength :
'').
' value="'.
dol_escape_htmltag($fieldValue).
'" name="'.$fieldlist[$field].
'">';
3303 print
'<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$transkey.
'">';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage third parties objects (customers, suppliers, prospects...)
dictFieldLabel($value, $tabname='', $tablib='')
Return the label of a field of a dictionary, translated, to use as title of a column.
dictFieldList($fieldlist, $obj=null, $tabname='', $context='')
Show fields in insert/edit mode.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getDictionaryValue($tablename, $field, $id, $checkentity=false, $rowidfield='rowid')
Return the value of a filed into a dictionary for the record $id.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
$context
@method int call_trigger(string $triggerName, ?User $user)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.