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(
"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, a.deductible as deductible, 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,deductible";
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,deductible";
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,deductible";
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,deductible";
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',
'phone_code',
'trunk_prefix');
907 foreach ($notmandatoryarray as $notmandatory) {
908 if ($value == $notmandatory && !
GETPOST($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 $langs->load(
'errors');
1001 setEventMessages($langs->transnoentities(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Code")),
null,
'errors');
1003 if ($id == DICT_COUNTRY && strlen(
GETPOST(
"code")) != 2) {
1005 $langs->load(
'errors');
1006 setEventMessages($langs->transnoentities(
"ErrorCountryCodeMustBe2Char", $langs->transnoentities(
"Code")),
null,
'errors');
1008 if ($id == DICT_PAIEMENT && strlen(
GETPOST(
"code")) >= 6) {
1010 $langs->load(
'errors');
1011 setEventMessages($langs->transnoentities(
"ErrorFieldMustHaveLessThanXChar", $langs->transnoentities(
"Code"),
'6'),
null,
'errors');
1016 $_POST[
"localtax1"] =
'0';
1019 $_POST[
"localtax2"] =
'0';
1021 if (
GETPOST(
'department_buyer_id') <= 0) {
1022 $_POST[
'department_buyer_id'] =
'';
1024 if (
GETPOST(
"accountancy_code") <= 0) {
1025 $_POST[
"accountancy_code"] =
'';
1027 if (
GETPOST(
"accountancy_code_sell") <= 0) {
1028 $_POST[
"accountancy_code_sell"] =
'';
1030 if (
GETPOST(
"accountancy_code_buy") <= 0) {
1031 $_POST[
"accountancy_code_buy"] =
'';
1034 $_POST[
"code"] = preg_replace(
'/[^a-zA-Z0-9_\-\+]/',
'',
GETPOST(
"code"));
1037 $tablename = $tabname[
$id];
1038 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1041 if ($ok &&
GETPOST(
'actionadd')) {
1043 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1045 $sql =
"SELECT MAX(".$tabrowid[
$id].
") as newid FROM ".MAIN_DB_PREFIX.$db->sanitize($tablename);
1046 $result = $db->query($sql);
1048 $obj = $db->fetch_object($result);
1049 $newid = ((int) $obj->newid) + 1;
1051 dol_print_error($db);
1056 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" (";
1058 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1059 $sql .= $tabrowid[
$id].
",";
1061 $sql .= $tabfieldinsert[
$id];
1066 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1067 $sql .= ((int) $newid).
",";
1070 foreach ($listfieldinsert as $f => $value) {
1071 $keycode = (isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
'');
1072 if (empty($keycode)) {
1076 if ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
1078 } elseif ($value ==
'taux' || $value ==
'localtax1') {
1080 } elseif ($value ==
'entity') {
1081 $_POST[$keycode] = (int)
getEntity($tablename, 0);
1088 if ($keycode ==
'sortorder') {
1090 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == DICT_TVA)) {
1092 } elseif ($keycode ==
'content') {
1093 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
1094 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
1097 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
1105 $resql = $db->query($sql);
1107 setEventMessages($langs->transnoentities(
"RecordCreatedSuccessfully"),
null,
'mesgs');
1111 if ($db->type ==
'pgsql' && $tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1112 $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))");
1116 if ($id == DICT_TVA &&
GETPOSTINT(
'country') > 0) {
1119 $_POST = array(
'id' => $id);
1121 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
1122 $langs->load(
'errors');
1123 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
1125 dol_print_error($db);
1131 if ($ok &&
GETPOST(
'actionmodify')) {
1132 if ($tabrowid[$id]) {
1133 $rowidcol = $tabrowid[
$id];
1135 $rowidcol =
"rowid";
1139 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET ";
1141 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
1142 $sql .= $tabrowid[
$id].
"=";
1143 $sql .=
"'".$db->escape($rowid).
"', ";
1146 foreach ($listfieldmodify as $field) {
1147 $keycode = empty($listfieldvalue[$i]) ?
'' : $listfieldvalue[$i];
1148 if (empty($keycode)) {
1152 if ($field ==
'price' || preg_match(
'/^amount/i', $field)) {
1154 } elseif ($field ==
'taux' || $field ==
'localtax1') {
1156 } elseif ($field ==
'entity') {
1157 $_POST[$keycode] = (int)
getEntity($tablename, 0);
1164 if ($keycode ==
'sortorder') {
1166 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == DICT_TVA)) {
1168 } elseif ($keycode ==
'content') {
1169 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
1170 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
1173 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
1178 if (in_array($rowidcol, array(
'code',
'code_iso'))) {
1179 $sql .=
" WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'";
1181 $sql .=
" WHERE ".$db->sanitize($rowidcol).
" = ".((int) $rowid);
1183 if (in_array(
'entity', $listfieldmodify)) {
1184 $sql .=
" AND entity = ".((int)
getEntity($tablename, 0));
1189 $resql = $db->query($sql);
1191 setEventMessages($db->error(),
null,
'errors');
1195 if (!$ok &&
GETPOST(
'actionadd')) {
1198 if (!$ok &&
GETPOST(
'actionmodify')) {
1203 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
1204 if ($tabrowid[$id]) {
1205 $rowidcol = $tabrowid[
$id];
1207 $rowidcol =
"rowid";
1210 $tablename = $tabname[
$id];
1211 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1213 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1216 $result = $db->query($sql);
1218 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
1219 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
1221 dol_print_error($db);
1227 if ($action == $acts[0]) {
1228 if ($tabrowid[$id]) {
1229 $rowidcol = $tabrowid[
$id];
1231 $rowidcol =
"rowid";
1234 $tablename = $tabname[
$id];
1235 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1238 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 1 WHERE ".$db->sanitize($rowidcol).
" = ".((int) $rowid).($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1240 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1245 if ($sql !==
null) {
1246 $result = $db->query($sql);
1248 dol_print_error($db);
1251 dol_print_error(
null,
"No DB entry or no code");
1256 if ($action == $acts[1]) {
1257 if ($tabrowid[$id]) {
1258 $rowidcol = $tabrowid[
$id];
1260 $rowidcol =
"rowid";
1263 $tablename = $tabname[
$id];
1264 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1267 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1269 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET active = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1274 if ($sql !==
null) {
1275 $result = $db->query($sql);
1277 dol_print_error($db);
1280 dol_print_error(
null,
"No DB entry or no code");
1285 if ($action ==
'activate_favorite') {
1286 if ($tabrowid[$id]) {
1287 $rowidcol = $tabrowid[
$id];
1289 $rowidcol =
"rowid";
1292 $tablename = $tabname[
$id];
1293 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1296 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 1 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1298 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1303 if ($sql !==
null) {
1304 $result = $db->query($sql);
1306 dol_print_error($db);
1309 dol_print_error(
null,
"No DB entry or no code");
1314 if ($action ==
'disable_favorite') {
1315 if ($tabrowid[$id]) {
1316 $rowidcol = $tabrowid[
$id];
1318 $rowidcol =
"rowid";
1321 $tablename = $tabname[
$id];
1322 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1325 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1327 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET favorite = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1332 if ($sql !==
null) {
1333 $result = $db->query($sql);
1335 dol_print_error($db);
1338 dol_print_error(
null,
"No DB entry or no code");
1343 if ($action ==
'activate_eec') {
1344 if ($tabrowid[$id]) {
1345 $rowidcol = $tabrowid[
$id];
1347 $rowidcol =
"rowid";
1350 $tablename = $tabname[
$id];
1351 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1354 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 1 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1356 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1361 if ($sql !==
null) {
1362 $result = $db->query($sql);
1364 dol_print_error($db);
1367 dol_print_error(
null,
"No DB entry or no code");
1372 if ($action ==
'disable_eec') {
1373 if ($tabrowid[$id]) {
1374 $rowidcol = $tabrowid[
$id];
1376 $rowidcol =
"rowid";
1379 $tablename = $tabname[
$id];
1380 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1383 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1385 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET eec = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1390 if ($sql !==
null) {
1391 $result = $db->query($sql);
1393 dol_print_error($db);
1396 dol_print_error(
null,
"No DB entry or no code");
1401 if ($action ==
'activate_sepa') {
1402 if ($tabrowid[$id]) {
1403 $rowidcol = $tabrowid[
$id];
1405 $rowidcol =
"rowid";
1408 $tablename = $tabname[
$id];
1409 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1412 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 1 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1414 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1419 if ($sql !==
null) {
1420 $result = $db->query($sql);
1422 dol_print_error($db);
1425 dol_print_error(
null,
"No DB entry or no code");
1430 if ($action ==
'disable_sepa') {
1431 if ($tabrowid[$id]) {
1432 $rowidcol = $tabrowid[
$id];
1434 $rowidcol =
"rowid";
1437 $tablename = $tabname[
$id];
1438 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1441 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 0 WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1443 $sql =
"UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tablename).
" SET sepa = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1448 if ($sql !==
null) {
1449 $result = $db->query($sql);
1451 dol_print_error($db);
1454 dol_print_error(
null,
"No DB entry or no code");
1463global $form, $formother;
1465$form =
new Form($db);
1468$title = $langs->trans(
"DictionarySetup");
1470llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-dict');
1472if (
GETPOSTINT(
'id') == DICT_SOCIALNETWORKS && $from ==
'socialnetworksetup') {
1473 $head = socialnetwork_prepare_head();
1479if ($id && empty($from)) {
1480 $title .=
' - '.$langs->trans($tablib[$id]);
1481 $linkback =
'<a href="'.$_SERVER[
'PHP_SELF'].
'">'.img_picto($langs->trans(
"BackToDictionaryList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToDictionaryList").
'</span></a>';
1483$titlepicto =
'title_setup';
1484if ($id == DICT_TVA &&
GETPOST(
'from') ==
'accountancy') {
1485 $title = $langs->trans(
"MenuVatAccounts");
1486 $titlepicto =
'accountancy';
1488if ($id == DICT_CHARGESOCIALES &&
GETPOST(
'from') ==
'accountancy') {
1489 $title = $langs->trans(
"MenuTaxAccounts");
1490 $titlepicto =
'accountancy';
1493$param =
'&id='.urlencode((
string) ($id));
1494if ($search_country_id ||
GETPOSTISSET(
'page') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha')) {
1495 $param .=
'&search_country_id='.urlencode((
string) ($search_country_id ? $search_country_id : -1));
1497if ($search_code !=
'') {
1498 $param .=
'&search_code='.urlencode($search_code);
1500if ($search_active !=
'') {
1501 $param .=
'&search_active='.urlencode($search_active);
1504 $param .=
'&entity='.(int) $entity;
1507 $param .=
'&from='.urlencode($from);
1509$paramwithsearch = $param;
1511 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
1514 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
1517 $paramwithsearch .=
'&from='.urlencode($from);
1522if ($action ==
'delete') {
1523 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);
1529 $sqlfields = $tabsql[
$id];
1531 $tablecode =
't.code';
1533 $tableprefixarray = array(
1534 DICT_FORME_JURIDIQUE =>
'f.code',
1535 DICT_DEPARTEMENTS =>
'd.code_departement',
1536 DICT_REGIONS =>
'r.code_region',
1537 DICT_COUNTRY =>
'c.code',
1538 DICT_CIVILITY =>
'c.code',
1539 DICT_ACTIONCOMM =>
'a.code',
1540 DICT_CHARGESOCIALES =>
'a.code',
1541 DICT_TYPENT =>
't.code',
1542 DICT_CURRENCIES =>
'c.code_iso',
1543 DICT_ECOTAXE =>
'e.code',
1544 DICT_HOLIDAY_TYPES =>
'h.code',
1545 DICT_HRM_PUBLIC_HOLIDAY =>
'a.code',
1546 DICT_UNITS =>
'r.code',
1547 DICT_SOCIALNETWORKS =>
's.code',
1553 if (!empty($tableprefixarray[$id])) {
1554 $tablecode = $tableprefixarray[
$id];
1555 $tableprefix = preg_replace(
'/\..*$/',
'.', $tablecode);
1558 if (empty($tableprefix) && preg_match(
'/SELECT ([a-z]\.)rowid/i', $sqlfields, $reg)) {
1559 $tableprefix = $reg[1];
1563 if (!preg_match(
'/ WHERE /', $sql)) {
1564 $sql .=
" WHERE 1 = 1";
1566 if ($search_country_id > 0) {
1567 if ($id == DICT_HRM_PUBLIC_HOLIDAY || $id == DICT_HOLIDAY_TYPES) {
1568 $sql .=
" AND (c.rowid IS NULL OR c.rowid = 0 OR c.rowid = ".((int) $search_country_id).
")";
1570 $sql .=
" AND c.rowid = ".((int) $search_country_id);
1573 if ($search_code !=
'') {
1576 if ($search_active ==
'yes') {
1577 $sql .=
" AND ".$db->sanitize($tableprefix).
"active = 1";
1578 } elseif ($search_active ==
'no') {
1579 $sql .=
" AND ".$db->sanitize($tableprefix).
"active = 0";
1583 $nbtotalofrecords =
'';
1586 $sqlforcount = preg_replace(
'/^.*\sFROM\s/',
'SELECT COUNT(*) as nbtotalofrecords FROM ', $sql);
1587 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1588 $resql = $db->query($sqlforcount);
1590 $objforcount = $db->fetch_object($resql);
1591 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1593 dol_print_error($db);
1596 if (($page * $listlimit) > $nbtotalofrecords) {
1605 if ($sortfield ==
'country') {
1606 $sortfield =
'country_code';
1608 $sql .= $db->order($sortfield, $sortorder);
1611 $tabsqlsort[
$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
' '.$sortorder.
',/i',
'', $tabsqlsort[$id]);
1612 $tabsqlsort[
$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
',/i',
'', $tabsqlsort[$id]);
1614 $sql .=
" ORDER BY ";
1616 $sql .= $tabsqlsort[
$id];
1618 $sql .= $db->plimit($listlimit + 1, $offset);
1622 if (empty($tabfield[$id])) {
1623 dol_print_error($db,
'The table with id '.
$id.
' has no array tabfield defined');
1626 $fieldlist = explode(
',', $tabfield[$id]);
1631 $arrayfields = array();
1632 $mainfieldlist = explode(
',', str_replace(
' ',
'', empty($tabfieldmain[$id]) ? $tabfield[$id] : $tabfieldmain[
$id]));
1633 foreach ($fieldlist as $key => $value) {
1634 if (empty($value) || in_array($value, array(
'entity',
'region_id',
'country_id',
'department_buyer_id'))) {
1637 $arrayfields[$value] = array(
1639 'checked' => (in_array($value, $mainfieldlist) ? 1 : 0),
1640 'position' => (int) $key
1644 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST" spellcheck="false">';
1645 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1646 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag($from).
'">';
1647 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1651 print
info_admin($langs->trans(
"VATIsUsedIsOff", $langs->transnoentities(
"Setup"), $langs->transnoentities(
"CompanyFoundation")));
1658 $resql = $db->query($sql);
1660 $num = $db->num_rows($resql);
1663 $massactionbutton = $linkback;
1665 $newcardbutton =
'';
1670 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/admin/dict.php?action=create'.$param.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
1672 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'tools', 0, $newcardbutton,
'', $listlimit,
'listlimit', 0, 1);
1675 if ($action ==
'create') {
1677 if ($tabname[$id]) {
1680 $fieldlist = explode(
',', $tabfield[$id]);
1682 print
'<div class="div-table-responsive-no-min">';
1683 print
'<table class="noborder centpercent">';
1686 print
'<!-- line title to add new entry -->';
1687 $tdsoffields =
'<tr class="liste_titre">';
1688 foreach ($fieldlist as $field => $value) {
1689 if ($value ==
'entity') {
1690 $withentity = (int)
getEntity($tabname[$id], 0);
1695 $valuetoshow = ucfirst($value);
1696 $valuetoshow = $langs->trans($valuetoshow);
1699 if ($value ==
'pos') {
1700 $valuetoshow = $langs->trans(
"Position");
1703 if ($value ==
'source') {
1704 $valuetoshow = $langs->trans(
"Contact");
1706 if ($value ==
'price') {
1707 $valuetoshow = $langs->trans(
"PriceUHT");
1709 if ($value ==
'taux') {
1710 if ($tabname[$id] !=
"c_revenuestamp") {
1711 $valuetoshow = $langs->trans(
"Rate");
1713 $valuetoshow = $langs->trans(
"Amount");
1717 if ($value ==
'localtax1_type') {
1718 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2";
1722 if ($value ==
'localtax1') {
1723 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2');
1724 $class =
"center minwidth75";
1726 if ($value ==
'localtax2_type') {
1727 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3";
1731 if ($value ==
'localtax2') {
1732 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3');
1733 $class =
"center minwidth75";
1735 if ($value ==
'type_vat') {
1736 $valuetoshow = $langs->trans(
"VATType");
1738 if ($value ==
'organization') {
1739 $valuetoshow = $langs->trans(
"Organization");
1741 if ($value ==
'lang') {
1742 $valuetoshow = $langs->trans(
"Language");
1744 if ($value ==
'type') {
1745 if ($tabname[$id] ==
"c_paiement") {
1746 $valuetoshow = $form->textwithtooltip($langs->trans(
"Type"), $langs->trans(
"TypePaymentDesc"), 2, 1, img_help(1,
''));
1748 $valuetoshow = $langs->trans(
"Type");
1751 if ($value ==
'code') {
1752 $valuetoshow = $langs->trans(
"Code");
1753 $class =
'maxwidth100';
1755 if ($value ==
'libelle' || $value ==
'label') {
1756 $valuetoshow = $form->textwithtooltip($langs->trans(
"Label"), $langs->trans(
"LabelUsedByDefault"), 2, 1, img_help(1,
''));
1758 if ($value ==
'libelle_facture') {
1759 $valuetoshow = $form->textwithtooltip($langs->trans(
"LabelOnDocuments"), $langs->trans(
"LabelUsedByDefault"), 2, 1, img_help(1,
''));
1761 if ($value ==
'deposit_percent') {
1762 $valuetoshow = $langs->trans(
'DepositPercent');
1765 if ($value ==
'country') {
1766 if (in_array(
'region_id', $fieldlist)) {
1770 $valuetoshow = $langs->trans(
"Country");
1772 if ($value ==
'department_buyer') {
1775 if ($value ==
'recuperableonly') {
1776 $valuetoshow = $langs->trans(
"NPR");
1779 if ($value ==
'einvoice_vatex') {
1780 $valuetoshow = $langs->trans(
"VATExemptionCode");
1783 if ($value ==
'nbjour') {
1784 $valuetoshow = $langs->trans(
"NbOfDays");
1787 if ($value ==
'type_cdr') {
1788 $valuetoshow = $langs->trans(
"AtEndOfMonth");
1791 if ($value ==
'decalage') {
1792 $valuetoshow = $langs->trans(
"Offset");
1795 if ($value ==
'width' || $value ==
'nx') {
1796 $valuetoshow = $langs->trans(
"Width");
1798 if ($value ==
'height' || $value ==
'ny') {
1799 $valuetoshow = $langs->trans(
"Height");
1801 if ($value ==
'unit' || $value ==
'metric') {
1802 $valuetoshow = $langs->trans(
"MeasuringUnit");
1804 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
1807 if ($value ==
'accountancy_code') {
1808 $valuetoshow = $langs->trans(
"AccountancyCode");
1810 if ($value ==
'accountancy_code_sell') {
1811 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
1813 if ($value ==
'accountancy_code_buy') {
1814 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
1816 if ($value ==
'pcg_version' || $value ==
'fk_pcg_version') {
1817 $valuetoshow = $langs->trans(
"Pcg_version");
1819 if ($value ==
'account_parent') {
1820 $valuetoshow = $langs->trans(
"Accountparent");
1822 if ($value ==
'pcg_type') {
1823 $valuetoshow = $langs->trans(
"Pcg_type");
1825 if ($value ==
'pcg_subtype') {
1826 $valuetoshow = $langs->trans(
"Pcg_subtype");
1828 if ($value ==
'sortorder') {
1829 $valuetoshow = $langs->trans(
"SortOrder");
1832 if ($value ==
'short_label') {
1833 $valuetoshow = $langs->trans(
"ShortLabel");
1835 if ($value ==
'fk_parent') {
1836 $valuetoshow = $langs->trans(
"ParentID");
1839 if ($value ==
'range_account') {
1840 $valuetoshow = $langs->trans(
"Range");
1842 if ($value ==
'sens') {
1843 $valuetoshow = $langs->trans(
"Sens");
1845 if ($value ==
'category_type') {
1846 $valuetoshow = $langs->trans(
"Calculated");
1848 if ($value ==
'formula') {
1849 $valuetoshow = $langs->trans(
"Formula");
1851 if ($value ==
'paper_size') {
1852 $valuetoshow = $langs->trans(
"PaperSize");
1854 if ($value ==
'orientation') {
1855 $valuetoshow = $langs->trans(
"Orientation");
1857 if ($value ==
'leftmargin') {
1858 $valuetoshow = $langs->trans(
"LeftMargin");
1860 if ($value ==
'topmargin') {
1861 $valuetoshow = $langs->trans(
"TopMargin");
1863 if ($value ==
'spacex') {
1864 $valuetoshow = $langs->trans(
"SpaceX");
1866 if ($value ==
'spacey') {
1867 $valuetoshow = $langs->trans(
"SpaceY");
1869 if ($value ==
'font_size') {
1870 $valuetoshow = $langs->trans(
"FontSize");
1872 if ($value ==
'custom_x') {
1873 $valuetoshow = $langs->trans(
"CustomX");
1875 if ($value ==
'custom_y') {
1876 $valuetoshow = $langs->trans(
"CustomY");
1878 if ($value ==
'percent') {
1879 $valuetoshow = $langs->trans(
"Percentage");
1881 if ($value ==
'affect') {
1882 $valuetoshow = $langs->trans(
"WithCounter");
1884 if ($value ==
'delay') {
1885 $valuetoshow = $langs->trans(
"NoticePeriod");
1887 if ($value ==
'newbymonth') {
1888 $valuetoshow = $langs->trans(
"NewByMonth");
1890 if ($value ==
'fk_tva') {
1891 $valuetoshow = $langs->trans(
"VAT");
1893 if ($value ==
'range_ik') {
1894 $valuetoshow = $langs->trans(
"RangeIk");
1896 if ($value ==
'fk_c_exp_tax_cat') {
1897 $valuetoshow = $langs->trans(
"CarCategory");
1899 if ($value ==
'revenuestamp_type') {
1900 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
1902 if ($value ==
'use_default') {
1903 $valuetoshow = $langs->trans(
'Default');
1906 if ($value ==
'unit_type') {
1907 $valuetoshow = $langs->trans(
'TypeOfUnit');
1909 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
1910 $valuetoshow = $langs->trans(
'TicketGroupIsPublic');
1913 if ($value ==
'block_if_negative') {
1914 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
1916 if ($value ==
'type_duration') {
1917 $valuetoshow = $langs->trans(
'Unit');
1920 if ($id == DICT_DEPARTEMENTS) {
1921 if ($value ==
'region_id') {
1922 $valuetoshow =
' ';
1925 if ($value ==
'region') {
1926 $valuetoshow = $langs->trans(
"Country").
'/'.$langs->trans(
"Region");
1931 if ($valuetoshow !=
'') {
1932 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[
$id]][
'help'][$value] :
'');
1934 $tdsoffields .=
'<th'.($class ?
' class="'.$class.
'"' :
'').
'>';
1935 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
1936 $tdsoffields .=
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.img_help(1, $valuetoshow).
'</a>';
1937 } elseif ($tooltiphelp) {
1938 $tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
1940 $tdsoffields .= $valuetoshow;
1942 $tdsoffields .=
'</th>';
1946 if ($id == DICT_COUNTRY) {
1947 $tdsoffields .=
'<th></th>';
1948 $tdsoffields .=
'<th></th>';
1950 $tdsoffields .=
'<th>';
1951 $tdsoffields .=
'<input type="hidden" name="id" value="'.$id.
'">';
1952 if (!is_null($withentity)) {
1953 $tdsoffields .=
'<input type="hidden" name="entity" value="'.$withentity.
'">';
1955 $tdsoffields .=
'</th>';
1956 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1957 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1958 $tdsoffields .=
'</tr>';
1964 print
'<!-- line input to add new entry -->';
1965 print
'<tr class="oddeven nodrag nodrop nohover">';
1970 foreach ($fieldlist as $key => $val) {
1977 $tmpaction =
'create';
1978 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
1979 $reshook = $hookmanager->executeHooks(
'createDictionaryFieldlist', $parameters, $obj, $tmpaction);
1980 $error = $hookmanager->error;
1981 $errors = $hookmanager->errors;
1983 if ($id == DICT_REGIONS) {
1984 unset($fieldlist[2]);
1987 if (empty($reshook)) {
1991 if ($id == DICT_COUNTRY) {
1996 print
'<td colspan="3" class="center">';
1997 if ($action !=
'edit') {
1998 print
'<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans(
"Add").
'">';
2000 print
'<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans(
"Add").
'">';
2012 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST" spellcheck="false">';
2013 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2014 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
2015 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
2020 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $contextpage,
$conf->main_checkbox_left_column, 0);
2023 foreach ($fieldlist as $field => $value) {
2024 if ($value ==
'entity') {
2029 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2032 if (empty($arrayfields[$value][
'checked'])) {
2037 if ($value ==
'country') {
2039 } elseif ($value ==
'code') {
2045 print
'<div class="div-table-responsive">';
2046 print
'<table class="noborder centpercent noborder">';
2051 print
'<!-- line title to search record -->'.
"\n";
2052 print
'<tr class="liste_titre_filter">';
2055 if (
$conf->main_checkbox_left_column) {
2056 print
'<td class="liste_titre center maxwidthsearch">';
2058 $searchpicto = $form->showFilterAndCheckAddButtons(0);
2065 foreach ($fieldlist as $field => $value) {
2066 if ($value ==
'entity') {
2071 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2074 if (empty($arrayfields[$value][
'checked'])) {
2079 if ($value ==
'country') {
2080 print
'<td class="liste_titre">';
2081 print $form->select_country($search_country_id,
'search_country_id',
'', 28,
'minwidth100 maxwidth150 maxwidthonsmartphone',
'',
' ');
2084 } elseif ($value ==
'code') {
2085 print
'<td class="liste_titre">';
2086 print
'<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).
'">';
2089 } elseif ($value ==
'type_vat') {
2090 print
'<td class="liste_titre">';
2091 print $form->selectarray(
'search_'.$value, $type_vatList, (empty($obj->{$value}) ?
'' : $obj->{$value}), 1);
2095 print
'<td class="liste_titre">';
2101 if ($id == DICT_COUNTRY) {
2111 print
'<td class="liste_titre center parentonrightofpage">';
2112 print $form->selectyesno(
'search_active', $search_active, 0,
false, 1, 1,
'maxwidth100 onrightofpage',
'Activated',
'Disabled');
2117 if (!
$conf->main_checkbox_left_column) {
2118 print
'<td class="liste_titre center maxwidthsearch">';
2120 $searchpicto = $form->showFilterAndCheckAddButtons(0);
2131 print
'<!-- line title of record -->'.
"\n";
2132 print
'<tr class="liste_titre">';
2135 if (
$conf->main_checkbox_left_column) {
2136 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'', ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center maxwidthsearch ');
2139 foreach ($fieldlist as $field => $value) {
2140 if ($value ==
'entity') {
2144 if (in_array($value, array(
'label',
'libelle',
'libelle_facture')) && empty($tabcomplete[$tabname[$id]][
'help'][$value])) {
2145 if (!isset($tabcomplete[$tabname[$id]][
'help']) || !is_array($tabcomplete[$tabname[$id]][
'help'])) {
2146 $tabcomplete[$tabname[
$id]][
'help'] = array();
2148 $tabcomplete[$tabname[
$id]][
'help'][$value] = $langs->trans(
'LabelUsedByDefault');
2156 $valuetoshow =
dictFieldLabel($value, $tabname[$id], $tablib[$id]);
2159 if ($value ==
'taux') {
2160 $cssprefix =
'center ';
2162 if (in_array($value, array(
'type_vat',
'localtax1_type',
'localtax1',
'localtax2_type',
'localtax2'))) {
2163 $cssprefix =
"center minwidth75 ";
2166 if (in_array($value, array(
'pos',
'position',
'deposit_percent',
'nbjour',
'decalage'))) {
2167 $cssprefix =
'right ';
2169 if ($value ==
'recuperableonly') {
2170 $cssprefix =
"center ";
2172 if ($value ==
'einvoice_vatex') {
2173 $cssprefix =
"center";
2175 if ($value ==
'type_cdr') {
2176 $cssprefix =
"center ";
2178 if ($value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2181 if (in_array($value, array(
'sortorder',
'fk_parent',
'use_default'))) {
2182 $cssprefix =
'center ';
2184 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
2185 $cssprefix =
'center ';
2188 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2191 if (empty($arrayfields[$value][
'checked'])) {
2197 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[
$id]][
'help'][$value] :
'');
2199 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
2200 $newvaluetoshow =
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.img_help(1, $valuetoshow).
'</a>';
2201 } elseif ($tooltiphelp) {
2202 $newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp);
2204 $newvaluetoshow = $valuetoshow;
2207 print
getTitleFieldOfList($newvaluetoshow, 0, $_SERVER[
"PHP_SELF"], ($sortable ? $value :
''), ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $cssprefix);
2211 if ($id == DICT_COUNTRY) {
2212 print
getTitleFieldOfList($langs->trans(
"InEEC"), 0, $_SERVER[
"PHP_SELF"],
"eec", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
"CountryIsInEEC"));
2213 print
getTitleFieldOfList($langs->trans(
"InSepa"), 0, $_SERVER[
"PHP_SELF"],
"sepa", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
"CountryIsInSepa"));
2214 print
getTitleFieldOfList($langs->trans(
"Favorite"), 0, $_SERVER[
"PHP_SELF"],
"favorite", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
2218 print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
2221 if (!
$conf->main_checkbox_left_column) {
2229 print
'<!-- lines of dict -->'.
"\n";
2231 $obj = $db->fetch_object($resql);
2236 $withentity = (isset($obj->entity) ? (int) $obj->entity : null);
2239 if ($id == DICT_COUNTRY) {
2240 if ($obj->code ==
'') {
2250 if (isset($obj->code) && !in_array($id, array(DICT_TVA, DICT_PRODUCT_NATURE))) {
2251 if (($obj->code ==
'0' || $obj->code ==
'' || preg_match(
'/unknown/i', $obj->code))) {
2254 } elseif ($obj->code ==
'RECEP') {
2257 } elseif ($obj->code ==
'EF0') {
2262 if ($id == DICT_TYPE_CONTAINER && $obj->module ==
'system') {
2265 if (in_array($obj->code, array(
'banner'))) {
2269 if (isset($obj->type) && in_array($obj->type, array(
'system',
'systemauto'))) {
2272 if (in_array(empty($obj->code) ?
'' : $obj->code, array(
'AC_OTH',
'AC_OTH_AUTO')) || in_array(empty($obj->
type) ?
'' : $obj->
type, array(
'systemauto'))) {
2276 $canbemodified = $iserasable;
2278 if (!empty($obj->code) && $obj->code ==
'RECEP') {
2281 if ($tabname[$id] ==
"c_actioncomm") {
2285 if ($tabname[$id] ==
"c_product_nature" && in_array($obj->code, array(0, 1))) {
2297 if (!is_null($withentity) && $withentity != (
int)
getEntity($tabname[$id], 0)) {
2303 $rowidcol = empty($tabrowid[$id]) ?
'rowid' : $tabrowid[
$id];
2305 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))) {
2306 $rowidcol =
'rowid';
2308 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder);
2309 $url .=
'&rowid='.(isset($obj->$rowidcol) ? ((int) $obj->$rowidcol) : (!empty($obj->code) ? urlencode($obj->code) :
''));
2310 $url .=
'&code='.(!empty($obj->code) ? urlencode($obj->code) :
'');
2311 if (!empty($param)) {
2315 if (!is_null($withentity)) {
2316 $url .=
'&entity='.((int) $withentity);
2322 print
'<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ?
'' : $obj->rowid).
'">';
2325 if (
$conf->main_checkbox_left_column) {
2326 print
'<td class="center maxwidthsearch nowraponall">';
2328 if ($canbemodified) {
2329 print
'<a class="reposition editfielda marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=edit&token='.
newToken().
'">'.img_edit().
'</a>';
2334 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=delete&token='.
newToken().
'">'.img_delete().
'</a>';
2343 if ($action ==
'edit' && ($rowid == (isset($obj->rowid) ? $obj->rowid : $obj->code))) {
2344 $tmpaction =
'edit';
2345 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
2346 $reshook = $hookmanager->executeHooks(
'editDictionaryFieldlist', $parameters, $obj, $tmpaction);
2347 $error = $hookmanager->error;
2348 $errors = $hookmanager->errors;
2351 if (empty($reshook)) {
2352 $withentity =
dictFieldList($fieldlist, $obj, $tabname[$id],
'edit');
2355 print
'<td colspan="3" class="center">';
2356 print
'<div name="'.(isset($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
2357 print
'<input type="hidden" name="page" value="'.((int) $page).
'">';
2358 print
'<input type="hidden" name="rowid" value="'.dol_escape_htmltag($rowid).
'">';
2359 if (!is_null($withentity)) {
2360 print
'<input type="hidden" name="entity" value="'.$withentity.
'">';
2362 print
'<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
2363 print
'<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
2366 $tmpaction =
'view';
2367 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
2368 $reshook = $hookmanager->executeHooks(
'viewDictionaryFieldlist', $parameters, $obj, $tmpaction);
2370 $error = $hookmanager->error;
2371 $errors = $hookmanager->errors;
2373 $langs->loadLangs(array(
"bills",
"agenda",
"propal"));
2375 if (empty($reshook)) {
2377 $TDurationTypes = $form->getDurationTypes($langs);
2379 foreach ($fieldlist as $field => $value) {
2380 $class = (isset($tabcomplete[$tabname[$id]][
'css'][$value]) ? $tabcomplete[$tabname[
$id]][
'css'][$value] :
'');
2382 if (empty($arrayfields[$value][
'checked'])) {
2385 $valuetoshow = (isset($obj->$value) && $obj->$value !==
'') ? $obj->$value :
'';
2388 if ($value ==
'entity') {
2389 $withentity = $valuetoshow;
2394 if ($value ==
'code' && $id == DICT_PRODUCT_NATURE) {
2395 $valuetoshow = (int) $valuetoshow;
2396 } elseif ($value ==
'element') {
2397 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
2398 } elseif ($value ==
'source') {
2399 $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
2400 } elseif ($valuetoshow ==
'all') {
2401 $valuetoshow = $langs->trans(
'All');
2402 } elseif ($value ==
'country') {
2403 if (empty($obj->country_code)) {
2406 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
2407 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code) ? $obj->country_code.
" - ".$key : $obj->country);
2409 } elseif ($value ==
'recuperableonly' || $value ==
'deductible' || $value ==
'category_type') {
2410 $valuetoshow = yn($valuetoshow ? 1 : 0);
2412 } elseif ($value ==
'type_cdr') {
2413 if (empty($valuetoshow)) {
2414 $valuetoshow = $langs->trans(
'None');
2415 } elseif ($valuetoshow == 1) {
2416 $valuetoshow = $langs->trans(
'AtEndOfMonth');
2417 } elseif ($valuetoshow == 2) {
2418 $valuetoshow = $langs->trans(
'CurrentNext');
2420 $class =
"center tdoverflowmax125";
2421 } elseif ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
2422 $valuetoshow =
price($valuetoshow);
2424 if (in_array($value, array(
'private',
'joinfile',
'use_default'))) {
2425 if (!empty($valuetoshow)) {
2426 $valuetoshow = img_picto(
'',
'tick');
2430 } elseif ($value ==
'libelle_facture') {
2431 $key = $langs->trans(
"PaymentCondition".strtoupper($obj->code));
2432 $valuetoshow = ($obj->code && $key !=
"PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value);
2433 $valuetoshow = nl2br($valuetoshow);
2434 $titletoshow = $valuetoshow;
2435 $class =
'small tdoverflowmax200';
2436 } elseif ($value ==
'label' && $tabname[$id] ==
'c_country') {
2437 $key = $langs->trans(
"Country".strtoupper($obj->code));
2438 $valuetoshow = ($obj->code && $key !=
"Country".strtoupper($obj->code) ? $key : $obj->$value);
2439 } elseif ($value ==
'label' && $tabname[$id] ==
'c_availability') {
2440 $key = $langs->trans(
"AvailabilityType".strtoupper($obj->code));
2441 $valuetoshow = ($obj->code && $key !=
"AvailabilityType".strtoupper($obj->code) ? $key : $obj->$value);
2442 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_actioncomm') {
2443 $key = $langs->trans(
"Action".strtoupper($obj->code));
2444 $valuetoshow = ($obj->code && $key !=
"Action".strtoupper($obj->code) ? $key : $obj->$value);
2445 } elseif (!empty($obj->code_iso) && $value ==
'label' && $tabname[$id] ==
'c_currencies') {
2446 $key = $langs->trans(
"Currency".strtoupper($obj->code_iso));
2447 $valuetoshow = ( $key !=
"Currency".strtoupper($obj->code_iso) ? $key : $obj->$value);
2448 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_typent') {
2449 $key = $langs->trans(strtoupper($obj->code));
2450 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
2451 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_prospectlevel') {
2452 $key = $langs->trans(strtoupper($obj->code));
2453 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
2454 } elseif ($value ==
'label' && $tabname[$id] ==
'c_civility') {
2455 $key = $langs->trans(
"Civility".strtoupper($obj->code));
2456 $valuetoshow = ($obj->code && $key !=
"Civility".strtoupper($obj->code) ? $key : $obj->$value);
2457 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_type_contact') {
2458 $key = $langs->trans(
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code));
2459 $valuetoshow = ($obj->code && $key !=
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code) ? $key : $obj->$value);
2460 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_payment_term') {
2461 $key = $langs->trans(
"PaymentConditionShort".strtoupper($obj->code));
2462 $valuetoshow = ($obj->code && $key !=
"PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value);
2463 $titletoshow = $key;
2464 $class =
"tdoverflowmax150";
2465 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paiement') {
2466 $key = $langs->trans(
"PaymentType".strtoupper($obj->code));
2467 $valuetoshow = $obj->$value;
2468 if ($obj->code && array_key_exists(
"PaymentType".strtoupper($obj->code), $langs->tab_translate)) {
2469 $htmltext = $form->textwithpicto($langs->trans(
"TranslationFound").
': '.$key, $langs->trans(
"TheTranslationIsSearchedFromKey",
"PaymentType".strtoupper($obj->code)));
2471 $htmltext = $form->textwithpicto($langs->trans(
"TranslationFound").
': '.$langs->trans(
"No"), $langs->trans(
"TheTranslationIsSearchedFromKey",
"PaymentType".strtoupper($obj->code)));
2474 $valuetoshow .=
'<br><span class="opacitymedium small">'.$htmltext.
'</span>';
2475 } elseif ($value ==
'type' && $tabname[$id] ==
'c_paiement') {
2476 $payment_type_list = array(0 => $langs->trans(
'PaymentTypeCustomer'), 1 => $langs->trans(
'PaymentTypeSupplier'), 2 => $langs->trans(
'PaymentTypeBoth'));
2477 $valuetoshow = $payment_type_list[$valuetoshow];
2478 } elseif ($value ==
'label' && $tabname[$id] ==
'c_input_reason') {
2479 $key = $langs->trans(
"DemandReasonType".strtoupper($obj->code));
2480 $valuetoshow = ($obj->code && $key !=
"DemandReasonType".strtoupper($obj->code) ? $key : $obj->$value);
2481 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_input_method') {
2482 $langs->load(
"orders");
2483 $key = $langs->trans($obj->code);
2484 $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->$value;
2485 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_shipment_mode') {
2486 $langs->load(
"sendings");
2487 $key = $langs->trans(
"SendingMethod".strtoupper($obj->code));
2488 $valuetoshow = ($obj->code && $key !=
"SendingMethod".strtoupper($obj->code) ? $key : $obj->$value);
2489 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paper_format') {
2490 $key = $langs->trans(
'PaperFormat'.strtoupper($obj->code));
2491 $valuetoshow = ($obj->code && $key !=
'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$value);
2492 } elseif ($value ==
'label' && $tabname[$id] ==
'c_type_fees') {
2493 $langs->load(
'trips');
2494 $key = $langs->trans(strtoupper($obj->code));
2495 $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$value);
2496 } elseif ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2498 } elseif ($value ==
'unicode') {
2499 $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
2500 } elseif ($value ==
'label' && $tabname[
GETPOSTINT(
"id")] ==
'c_units') {
2501 $langs->load(
"products");
2502 $valuetoshow = $langs->trans($obj->$value);
2503 } elseif ($value ==
'short_label' && $tabname[
GETPOSTINT(
"id")] ==
'c_units') {
2504 $langs->load(
"products");
2505 $valuetoshow = $langs->trans($obj->$value);
2506 } elseif (($value ==
'unit') && ($tabname[$id] ==
'c_paper_format')) {
2507 $key = $langs->trans(
'SizeUnit'.strtolower($obj->unit));
2508 $valuetoshow = ($obj->code && $key !=
'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$value);
2509 } elseif ($value ==
'localtax1' || $value ==
'localtax2') {
2511 } elseif ($value ==
'type_vat') {
2512 $valuetoshow = $type_vatList[(int) $valuetoshow];
2514 } elseif ($value ==
'localtax1_type') {
2515 if ($obj->localtax1 != 0) {
2516 $valuetoshow = $localtax_typeList[$valuetoshow];
2521 } elseif ($value ==
'localtax2_type') {
2522 if ($obj->localtax2 != 0) {
2523 $valuetoshow = $localtax_typeList[$valuetoshow];
2528 } elseif ($value ==
'taux') {
2529 $valuetoshow =
price($valuetoshow, 0, $langs, 0, 0);
2531 } elseif (in_array($value, array(
'recuperableonly'))) {
2533 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2535 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
2537 $tmpaccountingaccount->fetch(0, $valuetoshow, 1);
2538 $titletoshow = $langs->transnoentitiesnoconv(
"Pcgtype").
': '.$tmpaccountingaccount->pcg_type;
2541 } elseif ($value ==
'fk_tva') {
2542 if (empty($form->cache_vatrates)) {
2543 $form->load_tva(
'cache_fk_tva',
'',
$mysoc,
new Societe($db), 0, 0,
'',
false, -1);
2545 foreach ($form->cache_vatrates as $key => $Tab) {
2546 if ($form->cache_vatrates[$key][
'rowid'] == $valuetoshow) {
2547 $valuetoshow = $form->cache_vatrates[$key][
'label'];
2551 } elseif ($value ==
'fk_c_exp_tax_cat') {
2552 $tmpid = $valuetoshow;
2554 $valuetoshow = $langs->trans($valuetoshow ? $valuetoshow : $tmpid);
2555 } elseif ($tabname[$id] ==
'c_exp_tax_cat') {
2556 $valuetoshow = $langs->trans($valuetoshow);
2557 } elseif ($value ==
'libelle' && ($tabname[$id] ==
'c_stcomm' || $tabname[$id] ==
'c_stcommcontact')) {
2558 $key =
'StatusProspect'.$obj->rowid;
2559 $trans = $langs->trans($key);
2560 $valuetoshow = ($trans != $key ? $trans : $obj->{$value});
2561 } elseif ($value ==
'label' && $tabname[$id] ==
'c_units') {
2562 $langs->load(
'other');
2563 $key = $langs->trans($obj->label);
2564 $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
2565 } elseif ($value ==
'label' && $tabname[$id] ==
'c_product_nature') {
2566 $langs->load(
"products");
2567 $valuetoshow = $langs->trans($obj->{$value});
2568 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] ==
'c_productbatch_qcstatus') {
2569 $langs->load(
"productbatch");
2570 $valuetoshow = $langs->trans($obj->{$value});
2571 } elseif ($value ==
'block_if_negative') {
2572 $valuetoshow = yn($obj->{$value});
2573 } elseif ($value ==
'icon') {
2574 $valuetoshow = $obj->{$value}.
" ".img_picto(
"", preg_replace(
'/^fa-/',
'', $obj->{$value}));
2575 } elseif ($value ==
'type_duration') {
2576 if (!empty($obj->{$value}) && array_key_exists($obj->{$value}, $TDurationTypes)) {
2577 $valuetoshow = $TDurationTypes[$obj->{$value}];
2579 } elseif (in_array($value, array(
'leftmargin',
'topmargin',
'spacex',
'spacey',
'width',
'height',
'custom_x',
'custom_y'))) {
2581 } elseif ($value ==
'type' && $id == DICT_ACTIONCOMM && !empty($obj->module)) {
2582 $titletoshow = $langs->trans(
"Module").
' '.$obj->module;
2583 } elseif ($value ==
'color') {
2584 $valuetoshow = $formother->showColor($obj->{$value},
'');
2589 $class .= ($class ?
' ' :
'').
'tddict';
2590 if ($value ==
'name') {
2591 $class .=
' tdoverflowmax200';
2593 if ($value ==
'note' && $id == DICT_TVA) {
2594 $class .=
' tdoverflowmax200';
2596 if (in_array($value, array($value ==
'tracking'))) {
2597 $class .=
' tdoverflowauto';
2599 if (in_array($value, array(
'nbjour',
'decalage',
'pos',
'position',
'deposit_percent'))) {
2602 if (in_array($value, array(
'icon',
'type_vat',
'localtax1_type',
'localtax2_type'))) {
2603 $class .=
' nowraponall';
2605 if (in_array($value, array(
'use_default',
'fk_parent',
'sortorder',
'public'))) {
2606 $class .=
' center';
2608 if (in_array($value, array(
'localtax1_type',
'localtax2_type',
'note',
'note_public',
'note_private'))) {
2613 if (empty($titletoshow) && preg_match(
'/tdoverflow/', $class)) {
2614 $titletoshow = $valuetoshow;
2619 print
'<!-- field value '. $value .
' --><td class="'.$class.
'"'.($titletoshow ?
' title="'.dolPrintHTMLForAttribute($titletoshow).
'"' :
'').
'>'.$valuetoshow.
'</td>';
2625 if ($id == DICT_COUNTRY) {
2626 print
'<td class="nowraponall center">';
2629 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->eec].
'_eec&token='.
newToken().
'">'.$actl[$obj->eec].
'</a>';
2631 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2634 print
'<td class="nowraponall center">';
2637 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->sepa].
'_sepa&token='.
newToken().
'">'.$actl[$obj->sepa].
'</a>';
2639 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2642 print
'<td class="nowraponall center">';
2645 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->favorite].
'_favorite&token='.
newToken().
'">'.$actl[$obj->favorite].
'</a>';
2647 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2654 print
'<td class="nowraponall center">';
2655 if ($canbedisabled) {
2656 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
2658 if (in_array($obj->code, array(
'AC_OTH',
'AC_OTH_AUTO'))) {
2659 print $langs->trans(
"AlwaysActive");
2660 } elseif (isset($obj->type) && in_array($obj->type, array(
'systemauto')) && empty($obj->active)) {
2661 print $langs->trans(
"Deprecated");
2662 } elseif (isset($obj->type) && in_array($obj->type, array(
'system')) && !empty($obj->active) && $obj->code !=
'AC_OTH') {
2663 print $langs->trans(
"UsedOnlyWithTypeOption");
2665 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2671 if (!
$conf->main_checkbox_left_column) {
2672 print
'<td class="center maxwidthsearch nowraponall">';
2674 if ($canbemodified) {
2675 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.
'action=edit&token='.
newToken().
'">'.img_edit().
'</a>';
2680 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=delete&token='.
newToken().
'">'.img_delete().
'</a>';
2691 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2697 dol_print_error($db);
2707 print
'<span class="opacitymedium">'.$langs->trans(
"DictionaryDesc");
2708 print
" ".$langs->trans(
"OnlyActiveElementsAreShown").
"<br>\n";
2709 print
'</span><br>';
2712 $lastlineisempty =
false;
2714 print
'<div class="div-table-responsive-no-min">';
2715 print
'<table class="noborder centpercent">';
2716 print
'<tr class="liste_titre">';
2717 print
'<td>'.$langs->trans(
"Dictionary").
'</td>';
2719 print
'<td class="hideonsmartphone"></td>';
2722 $showemptyline =
'';
2723 foreach ($taborder as $i) {
2724 if (isset($tabname[$i]) && empty($tabcond[$i])) {
2729 if ($showemptyline) {
2730 print
'<tr class="oddeven"><td></td><td></td><td class="hideonsmartphone"></td></tr>';
2735 $value = $tabname[$i];
2736 print
'<tr class="oddeven"><td class="minwidth200">';
2737 if (!empty($tabcond[$i])) {
2738 $tabnamenoprefix = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabname[$i]);
2739 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i;
2740 if ($i == DICT_CHARGESOCIALES) {
2741 print
'&search_country_id='.$mysoc->country_id;
2744 if (!empty($tabcomplete[$tabnamenoprefix][
'picto'])) {
2745 print img_picto(
'', $tabcomplete[$tabnamenoprefix][
'picto'],
'class="pictofixedwidth paddingrightonly"');
2747 print $langs->trans($tablib[$i]);
2750 print $langs->trans($tablib[$i]);
2754 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i.
'">';
2755 print img_picto(
'Edit',
'edit',
'');
2758 print
'<td class="right hideonsmartphone">';
2759 print $form->textwithpicto(
'', $langs->trans(
"Table").
': '.MAIN_DB_PREFIX.$tabname[$i]);
2762 $lastlineisempty =
false;
2764 if (!$lastlineisempty) {
2766 $lastlineisempty =
true;
2795 $valuetoshow = ucfirst($value);
2796 $valuetoshow = $langs->trans($valuetoshow);
2799 if ($value ==
'source') {
2800 $valuetoshow = $langs->trans(
"Contact");
2802 if ($value ==
'price') {
2803 $valuetoshow = $langs->trans(
"PriceUHT");
2805 if ($value ==
'taux') {
2806 if ($tabname !=
"c_revenuestamp") {
2807 $valuetoshow = $langs->trans(
"Rate");
2809 $valuetoshow = $langs->trans(
"Amount");
2812 if ($value ==
'type_vat') {
2813 $valuetoshow = $langs->trans(
"VATType");
2815 if ($value ==
'localtax1_type') {
2816 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2";
2818 if ($value ==
'localtax1') {
2819 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2');
2821 if ($value ==
'localtax2_type') {
2822 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3";
2824 if ($value ==
'localtax2') {
2825 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3');
2827 if ($value ==
'organization') {
2828 $valuetoshow = $langs->trans(
"Organization");
2830 if ($value ==
'lang') {
2831 $valuetoshow = $langs->trans(
"Language");
2833 if ($value ==
'type') {
2834 $valuetoshow = $langs->trans(
"Type");
2836 if ($value ==
'code') {
2837 $valuetoshow = $langs->trans(
"Code");
2839 if (in_array($value, array(
'pos',
'position'))) {
2840 $valuetoshow = $langs->trans(
"Position");
2842 if ($value ==
'libelle' || $value ==
'label') {
2843 $valuetoshow = $langs->trans(
"Label");
2845 if ($value ==
'libelle_facture') {
2846 $valuetoshow = $langs->trans(
"LabelOnDocuments");
2848 if ($value ==
'deposit_percent') {
2849 $valuetoshow = $langs->trans(
'DepositPercent');
2851 if ($value ==
'country') {
2852 $valuetoshow = $langs->trans(
"Country");
2854 if ($value ==
'phone_code') {
2855 $valuetoshow = $langs->trans(
"PhoneCode");
2857 if ($value ==
'trunk_prefix') {
2858 $valuetoshow = $langs->trans(
"TrunkPrefix");
2860 if ($value ==
'department_buyer') {
2861 $valuetoshow = $langs->trans(
'DepartmentBuyer');
2863 if ($value ==
'recuperableonly') {
2864 $valuetoshow = $langs->trans(
"NPR");
2866 if ($value ==
'einvoice_vatex') {
2867 $valuetoshow = $langs->trans(
"VATExemptionCode");
2869 if ($value ==
'nbjour') {
2870 $valuetoshow = $langs->trans(
"NbOfDays");
2872 if ($value ==
'type_cdr') {
2873 $valuetoshow = $langs->trans(
"AtEndOfMonth");
2875 if ($value ==
'decalage') {
2876 $valuetoshow = $langs->trans(
"Offset");
2878 if ($value ==
'width' || $value ==
'nx') {
2879 $valuetoshow = $langs->trans(
"Width");
2881 if ($value ==
'height' || $value ==
'ny') {
2882 $valuetoshow = $langs->trans(
"Height");
2884 if ($value ==
'unit' || $value ==
'metric') {
2885 $valuetoshow = $langs->trans(
"MeasuringUnit");
2887 if ($value ==
'accountancy_code') {
2888 $valuetoshow = $langs->trans(
"AccountancyCode");
2890 if ($value ==
'accountancy_code_sell') {
2891 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
2893 if ($value ==
'accountancy_code_buy') {
2894 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
2896 if ($value ==
'fk_pcg_version') {
2897 $valuetoshow = $langs->trans(
"Pcg_version");
2899 if ($value ==
'account_parent') {
2900 $valuetoshow = $langs->trans(
"Accountsparent");
2902 if ($value ==
'pcg_type') {
2903 $valuetoshow = $langs->trans(
"Pcg_type");
2905 if ($value ==
'pcg_subtype') {
2906 $valuetoshow = $langs->trans(
"Pcg_subtype");
2908 if ($value ==
'sortorder') {
2909 $valuetoshow = $langs->trans(
"SortOrder");
2911 if ($value ==
'short_label') {
2912 $valuetoshow = $langs->trans(
"ShortLabel");
2914 if ($value ==
'fk_parent') {
2915 $valuetoshow = $langs->trans(
"ParentID");
2917 if ($value ==
'range_account') {
2918 $valuetoshow = $langs->trans(
"Range");
2920 if ($value ==
'sens') {
2921 $valuetoshow = $langs->trans(
"Sens");
2923 if ($value ==
'category_type') {
2924 $valuetoshow = $langs->trans(
"Calculated");
2926 if ($value ==
'formula') {
2927 $valuetoshow = $langs->trans(
"Formula");
2929 if ($value ==
'paper_size') {
2930 $valuetoshow = $langs->trans(
"PaperSize");
2932 if ($value ==
'orientation') {
2933 $valuetoshow = $langs->trans(
"Orientation");
2935 if ($value ==
'leftmargin') {
2936 $valuetoshow = $langs->trans(
"LeftMargin");
2938 if ($value ==
'topmargin') {
2939 $valuetoshow = $langs->trans(
"TopMargin");
2941 if ($value ==
'spacex') {
2942 $valuetoshow = $langs->trans(
"SpaceX");
2944 if ($value ==
'spacey') {
2945 $valuetoshow = $langs->trans(
"SpaceY");
2947 if ($value ==
'font_size') {
2948 $valuetoshow = $langs->trans(
"FontSize");
2950 if ($value ==
'custom_x') {
2951 $valuetoshow = $langs->trans(
"CustomX");
2953 if ($value ==
'custom_y') {
2954 $valuetoshow = $langs->trans(
"CustomY");
2956 if ($value ==
'percent') {
2957 $valuetoshow = $langs->trans(
"Percentage");
2959 if ($value ==
'affect') {
2960 $valuetoshow = $langs->trans(
"WithCounter");
2962 if ($value ==
'delay') {
2963 $valuetoshow = $langs->trans(
"NoticePeriod");
2965 if ($value ==
'newbymonth') {
2966 $valuetoshow = $langs->trans(
"NewByMonth");
2968 if ($value ==
'fk_tva') {
2969 $valuetoshow = $langs->trans(
"VAT");
2971 if ($value ==
'range_ik') {
2972 $valuetoshow = $langs->trans(
"RangeIk");
2974 if ($value ==
'fk_c_exp_tax_cat') {
2975 $valuetoshow = $langs->trans(
"CarCategory");
2977 if ($value ==
'revenuestamp_type') {
2978 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
2980 if ($value ==
'use_default') {
2981 $valuetoshow = $langs->trans(
'Default');
2983 if ($value ==
'unit_type') {
2984 $valuetoshow = $langs->trans(
'TypeOfUnit');
2986 if ($value ==
'public' && $tablib ==
'TicketDictCategory') {
2987 $valuetoshow = $langs->trans(
'TicketGroupIsPublic');
2989 if ($value ==
'block_if_negative') {
2990 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
2992 if ($value ==
'type_duration') {
2993 $valuetoshow = $langs->trans(
'Unit');
2996 return $valuetoshow;
3011 global $langs, $db,
$mysoc;
3012 global $form, $formother;
3014 global $elementList, $sourceList, $localtax_typeList, $type_vatList;
3022 foreach ($fieldlist as $field => $value) {
3023 if ($value ==
'entity' && isset($obj->$value)) {
3024 $withentity = $obj->$value;
3028 if (in_array($value, array(
'code',
'libelle',
'type')) && $tabname ==
"c_actioncomm" && isset($obj->$value) && in_array($obj->type, array(
'system',
'systemauto'))) {
3030 $hidden = (!empty($obj->{$value}) ? $obj->{$value} :
'');
3032 print
'<input type="hidden" name="'. $value .
'" value="'.$hidden.
'">';
3033 print $langs->trans($hidden);
3035 } elseif ($value ==
'country') {
3036 if (in_array(
'region_id', $fieldlist)) {
3043 $selected = (!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country :
''));
3045 $selected =
GETPOST(
'countryidforinsert');
3047 print $form->select_country($selected, $value,
'', 28,
'minwidth100 maxwidth150 maxwidthonsmartphone');
3049 } elseif ($value ==
'country_id') {
3050 if (!in_array(
'country', $fieldlist)) {
3051 $country_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
3052 print
'<td class="tdoverflowmax100">';
3053 print
'<input type="hidden" name="'. $value .
'" value="'.$country_id.
'">';
3056 } elseif ($value ==
'region') {
3058 $formcompany->select_region($region_id,
'region');
3060 } elseif ($value ==
'region_id') {
3061 $region_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
3063 print
'<input type="hidden" name="'. $value .
'" value="'.$region_id.
'">';
3065 } elseif ($value ==
'department_buyer') {
3067 print
'<td class="nowraponall">';
3069 $country_code = (!empty($obj->country_code) ? $obj->country_code :
'');
3070 $department_buyer_id = (!empty($obj->department_buyer_id) ? (int) $obj->department_buyer_id : 0);
3071 if ($country_code !=
'') {
3072 print $formcompany->select_state($department_buyer_id, $country_code,
'department_buyer_id',
'minwidth100 maxwidth150 maxwidthonsmartphone');
3076 } elseif ($value ==
'department_buyer_id') {
3077 if (!in_array(
'department_buyer', $fieldlist)) {
3078 $department_buyer_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
3079 print
'<td class="tdoverflowmax100">';
3080 print
'<input type="hidden" name="'.$value.
'" value="'.$department_buyer_id.
'">';
3083 } elseif ($value ==
'lang') {
3087 } elseif (in_array($value, array(
'element',
'source'))) {
3088 $tmparray = array();
3089 if ($value ==
'element') {
3090 $tmparray = $elementList;
3092 $tmparray = $sourceList;
3095 print $form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value} :
''), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth250');
3097 } elseif (in_array($value, array(
'public',
'use_default'))) {
3099 print
'<td class="center">';
3101 print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} :
''), 1);
3103 } elseif ($value ==
'private') {
3106 print $form->selectyesno(
"private", (!empty($obj->{$value}) ? $obj->{$value} :
''));
3108 } elseif ($value ==
'type' && $tabname ==
"c_actioncomm") {
3109 $type = (!empty($obj->type) ? $obj->type :
'user');
3111 print $type.
'<input type="hidden" name="type" value="'.$type.
'">';
3113 } elseif ($value ==
'type' && $tabname ==
'c_paiement') {
3115 $select_list = array(0 => $langs->trans(
'PaymentTypeCustomer'), 1 => $langs->trans(
'PaymentTypeSupplier'), 2 => $langs->trans(
'PaymentTypeBoth'));
3117 print $form->selectarray($value, $select_list, (isset($obj->{$value}) && $obj->{$value} !==
'' ? $obj->{$value} :
'2'));
3119 } elseif ($value ==
'recuperableonly' || $value ==
'type_cdr' || $value ==
'deductible' || $value ==
'category_type') {
3120 if ($value ==
'type_cdr') {
3121 print
'<td class="center">';
3125 if ($value ==
'type_cdr') {
3126 print $form->selectarray($value, array(0 => $langs->trans(
'None'), 1 => $langs->trans(
'AtEndOfMonth'), 2 => $langs->trans(
'CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value} :
''));
3129 print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} :
''), 1);
3132 } elseif (in_array($value, array(
'nbjour',
'decalage',
'taux',
'localtax1',
'localtax2'))) {
3134 if (in_array($value, array(
'taux',
'localtax1',
'localtax2'))) {
3137 print
'<td class="'.$class.
'">';
3138 print
'<input type="text" class="flat" value="'.(isset($obj->{$value}) ? $obj->{$value} :
'').
'" size="3" name="'. $value .
'">';
3140 } elseif (in_array($value, array(
'libelle_facture',
'content'))) {
3145 if ($tabname ==
'c_payment_term') {
3146 $langs->load(
"bills");
3147 if (isset($obj->code) && !empty($obj->code)) {
3148 $transkey =
"PaymentCondition" . strtoupper($obj->code);
3149 if ($langs->trans($transkey) != $transkey) {
3151 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
3156 print
'<textarea cols="30" rows="'.ROWS_2.
'" class="flat" name="'. $value .
'">'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'</textarea>';
3158 print
'<input type="hidden" name="'. $value .
'" value="'.$transkey.
'">';
3161 } elseif ($value ==
'price' || preg_match(
'/^amount/i', (
string) $value)) {
3162 print
'<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value} :
'')).
'" name="'. $value .
'"></td>';
3163 } elseif ($value ==
'code' && isset($obj->{$value})) {
3165 if ($tabname ==
'c_paiement' && in_array($obj->{$value}, array(
'LIQ',
'CB',
'CHQ',
'VIR'))) {
3167 print
'<input type="hidden" class="flat minwidth75 maxwidth100" value="'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'" name="'. $value .
'">';
3168 print $obj->{$value};
3170 print
'<input type="text" class="flat minwidth75 maxwidth100" value="'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'" name="'. $value .
'">';
3173 } elseif ($value ==
'unit') {
3176 'mm' => $langs->trans(
'SizeUnitmm'),
3177 'cm' => $langs->trans(
'SizeUnitcm'),
3178 'point' => $langs->trans(
'SizeUnitpoint'),
3179 'inch' => $langs->trans(
'SizeUnitinch')
3181 print $form->selectarray(
'unit', $units, (empty($obj->{$value}) ?
'' : $obj->{$value}), 0, 0, 0);
3183 } elseif ($value ==
'type_vat') {
3185 print
'<td class="center">';
3186 print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ?
'0' : $obj->{$value}));
3188 } elseif ($value ==
'localtax1_type' || $value ==
'localtax2_type') {
3190 print
'<td class="center">';
3191 print $form->selectarray($value, $localtax_typeList, (empty($obj->{$value}) ?
'' : $obj->{$value}));
3193 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
3196 $fieldname = $value;
3197 $accountancy_account = (empty($obj->$fieldname) ? 0 : $obj->$fieldname);
3198 print $formaccounting->select_account($accountancy_account,
'.'. $value, 1, array(), 1, 1,
'maxwidth125 maxwidthonsmartphone');
3200 $fieldname = $value;
3201 print
'<input type="text" class="flat minwidth100" value="'.(isset($obj->$fieldname) ? $obj->$fieldname :
'').
'" name="'. $value .
'">';
3204 } elseif ($value ==
'fk_tva') {
3206 print $form->load_tva(
'fk_tva', $obj->taux,
$mysoc,
new Societe($db), 0, 0,
'',
false, -1);
3208 } elseif ($value ==
'fk_c_exp_tax_cat') {
3210 print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
3212 } elseif ($value ==
'fk_range') {
3214 print $form->selectExpenseRanges($obj->fk_range);
3216 } elseif ($value ==
'block_if_negative') {
3218 print $form->selectyesno(
"block_if_negative", (empty($obj->block_if_negative) ?
'' : $obj->block_if_negative), 1);
3220 } elseif ($value ==
'type_duration') {
3222 print $form->selectTypeDuration(
'', (empty($obj->type_duration) ?
'' : $obj->type_duration), [
's',
'i',
'h']);
3224 } elseif ($value ==
'color') {
3226 print $formother->selectColor((empty($obj->{$value}) ?
'' : $obj->{$value}),
'color');
3229 $fieldValue = isset($obj->{$value}) ? $obj->{$value} :
'';
3233 if ($value ==
'sortorder') {
3234 $fieldlist[$field] =
'position';
3237 if ($fieldlist[$field] ==
'code') {
3238 $class =
'maxwidth100';
3240 if (in_array($fieldlist[$field], array(
'deposit_percent'))) {
3242 $class =
'maxwidth50 right';
3244 if (in_array($fieldlist[$field], array(
'pos',
'position'))) {
3246 $class =
'maxwidth50 right';
3248 if (in_array($fieldlist[$field], array(
'dayrule',
'day',
'month',
'year',
'use_default',
'affect',
'delay',
'public',
'sortorder',
'sens',
'category_type',
'fk_parent'))) {
3249 $class =
'maxwidth50 center';
3251 if (in_array($fieldlist[$field], array(
'use_default',
'public',
'fk_parent'))) {
3252 $classtd =
'center';
3254 if (in_array($fieldlist[$field], array(
'libelle',
'label',
'tracking'))) {
3255 $class =
'quatrevingtpercent';
3258 if ($fieldlist[$field] ==
'fk_parent') {
3259 if (empty($fieldValue)) {
3266 if (in_array($fieldlist[$field], array(
'libelle',
'label'))) {
3269 case 'c_email_senderprofile':
3270 case 'c_forme_juridique':
3271 case 'c_holiday_types':
3272 case 'c_payment_term':
3273 case 'c_transport_mode':
3274 $maxlength =
' maxlength="255"';
3276 case 'c_email_templates':
3277 $maxlength =
' maxlength="180"';
3279 case 'c_socialnetworks':
3280 $maxlength =
' maxlength="150"';
3283 $maxlength =
' maxlength="128"';
3287 print
'<td class="'.$classtd.
'">';
3290 if (in_array($fieldlist[$field], array(
'label',
'libelle'))) {
3292 if ($tabname ==
'c_civility' && !empty($obj->code)) {
3293 $transkey =
"Civility".strtoupper($obj->code);
3295 if ($tabname ==
'c_payment_term' && !empty($obj->code)) {
3296 $langs->load(
"bills");
3297 $transkey =
"PaymentConditionShort".strtoupper($obj->code);
3299 if ($transkey && $langs->trans($transkey) != $transkey) {
3301 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
3305 print
'<input type="text" class="flat'.($class ?
' '.$class :
'').
'"'.($maxlength ?
' '.$maxlength :
'').
' value="'.
dol_escape_htmltag($fieldValue).
'" name="'.$fieldlist[$field].
'">';
3307 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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage accounting accounts.
Class to manage third parties objects (customers, suppliers, prospects...)
$context
@method int call_trigger(string $triggerName, ?User $user)
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, $currencycode='')
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)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.