37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47 $langs->loadLangs(array(
"errors",
"admin",
"main",
"companies",
"resource",
"holiday",
"accountancy",
"hrm",
"orders",
"contracts",
"projects",
"propal",
"bills",
"interventions"));
49 $action =
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view';
50 $confirm =
GETPOST(
'confirm',
'alpha');
52 $rowid =
GETPOST(
'rowid',
'alpha');
53 $entity =
GETPOST(
'entity',
'int');
54 $code =
GETPOST(
'code',
'alpha');
56 $allowed = $user->admin;
57 if ($id == 7 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1;
58 if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1;
59 if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1;
62 $acts = array(); $actl = array();
63 $acts[0] =
"activate";
65 $actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off');
66 $actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on');
68 $listoffset =
GETPOST(
'listoffset');
69 $listlimit =
GETPOST(
'listlimit') > 0 ?
GETPOST(
'listlimit') : 1000;
72 $sortfield =
GETPOST(
"sortfield",
'alpha');
73 $sortorder =
GETPOST(
"sortorder",
'alpha');
75 if (empty($page) || $page == -1) { $page = 0; }
76 $offset = $listlimit * $page;
77 $pageprev = $page - 1;
78 $pagenext = $page + 1;
80 $search_country_id =
GETPOST(
'search_country_id',
'int');
81 if (!
GETPOSTISSET(
'search_country_id') && $search_country_id ==
'' && ($id == 2 || $id == 3 || $id == 10))
83 $search_country_id = $mysoc->country_id;
85 $search_code =
GETPOST(
'search_code',
'alpha');
88 $hookmanager->initHooks(array(
'admin'));
94 $taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 25, 0);
98 $tabname[1] = MAIN_DB_PREFIX.
"c_forme_juridique";
99 $tabname[2] = MAIN_DB_PREFIX.
"c_departements";
100 $tabname[3] = MAIN_DB_PREFIX.
"c_regions";
101 $tabname[4] = MAIN_DB_PREFIX.
"c_country";
102 $tabname[5] = MAIN_DB_PREFIX.
"c_civility";
103 $tabname[6] = MAIN_DB_PREFIX.
"c_actioncomm";
104 $tabname[7] = MAIN_DB_PREFIX.
"c_chargesociales";
105 $tabname[8] = MAIN_DB_PREFIX.
"c_typent";
106 $tabname[9] = MAIN_DB_PREFIX.
"c_currencies";
107 $tabname[10] = MAIN_DB_PREFIX.
"c_tva";
108 $tabname[11] = MAIN_DB_PREFIX.
"c_type_contact";
109 $tabname[12] = MAIN_DB_PREFIX.
"c_payment_term";
110 $tabname[13] = MAIN_DB_PREFIX.
"c_paiement";
111 $tabname[14] = MAIN_DB_PREFIX.
"c_ecotaxe";
112 $tabname[15] = MAIN_DB_PREFIX.
"c_paper_format";
113 $tabname[16] = MAIN_DB_PREFIX.
"c_prospectlevel";
114 $tabname[17] = MAIN_DB_PREFIX.
"c_type_fees";
115 $tabname[18] = MAIN_DB_PREFIX.
"c_shipment_mode";
116 $tabname[19] = MAIN_DB_PREFIX.
"c_effectif";
117 $tabname[20] = MAIN_DB_PREFIX.
"c_input_method";
118 $tabname[21] = MAIN_DB_PREFIX.
"c_availability";
119 $tabname[22] = MAIN_DB_PREFIX.
"c_input_reason";
120 $tabname[23] = MAIN_DB_PREFIX.
"c_revenuestamp";
121 $tabname[24] = MAIN_DB_PREFIX.
"c_type_resource";
122 $tabname[25] = MAIN_DB_PREFIX.
"c_type_container";
124 $tabname[27] = MAIN_DB_PREFIX.
"c_stcomm";
125 $tabname[28] = MAIN_DB_PREFIX.
"c_holiday_types";
126 $tabname[29] = MAIN_DB_PREFIX.
"c_lead_status";
127 $tabname[30] = MAIN_DB_PREFIX.
"c_format_cards";
129 $tabname[32] = MAIN_DB_PREFIX.
"c_hrm_public_holiday";
130 $tabname[33] = MAIN_DB_PREFIX.
"c_hrm_department";
131 $tabname[34] = MAIN_DB_PREFIX.
"c_hrm_function";
132 $tabname[35] = MAIN_DB_PREFIX.
"c_exp_tax_cat";
133 $tabname[36] = MAIN_DB_PREFIX.
"c_exp_tax_range";
134 $tabname[37] = MAIN_DB_PREFIX.
"c_units";
135 $tabname[38] = MAIN_DB_PREFIX.
"c_socialnetworks";
136 $tabname[39] = MAIN_DB_PREFIX.
"c_prospectcontactlevel";
137 $tabname[40] = MAIN_DB_PREFIX.
"c_stcommcontact";
138 $tabname[41] = MAIN_DB_PREFIX.
"c_transport_mode";
139 $tabname[42] = MAIN_DB_PREFIX.
"c_product_nature";
143 $tablib[1] =
"DictionaryCompanyJuridicalType";
144 $tablib[2] =
"DictionaryCanton";
145 $tablib[3] =
"DictionaryRegion";
146 $tablib[4] =
"DictionaryCountry";
147 $tablib[5] =
"DictionaryCivility";
148 $tablib[6] =
"DictionaryActions";
149 $tablib[7] =
"DictionarySocialContributions";
150 $tablib[8] =
"DictionaryCompanyType";
151 $tablib[9] =
"DictionaryCurrency";
152 $tablib[10] =
"DictionaryVAT";
153 $tablib[11] =
"DictionaryTypeContact";
154 $tablib[12] =
"DictionaryPaymentConditions";
155 $tablib[13] =
"DictionaryPaymentModes";
156 $tablib[14] =
"DictionaryEcotaxe";
157 $tablib[15] =
"DictionaryPaperFormat";
158 $tablib[16] =
"DictionaryProspectLevel";
159 $tablib[17] =
"DictionaryFees";
160 $tablib[18] =
"DictionarySendingMethods";
161 $tablib[19] =
"DictionaryStaff";
162 $tablib[20] =
"DictionaryOrderMethods";
163 $tablib[21] =
"DictionaryAvailability";
164 $tablib[22] =
"DictionarySource";
165 $tablib[23] =
"DictionaryRevenueStamp";
166 $tablib[24] =
"DictionaryResourceType";
167 $tablib[25] =
"DictionaryTypeOfContainer";
169 $tablib[27] =
"DictionaryProspectStatus";
170 $tablib[28] =
"DictionaryHolidayTypes";
171 $tablib[29] =
"DictionaryOpportunityStatus";
172 $tablib[30] =
"DictionaryFormatCards";
174 $tablib[32] =
"DictionaryPublicHolidays";
175 $tablib[33] =
"DictionaryDepartment";
176 $tablib[34] =
"DictionaryFunction";
177 $tablib[35] =
"DictionaryExpenseTaxCat";
178 $tablib[36] =
"DictionaryExpenseTaxRange";
179 $tablib[37] =
"DictionaryMeasuringUnits";
180 $tablib[38] =
"DictionarySocialNetworks";
181 $tablib[39] =
"DictionaryProspectContactLevel";
182 $tablib[40] =
"DictionaryProspectContactStatus";
183 $tablib[41] =
"DictionaryTransportMode";
184 $tablib[42] =
"DictionaryProductNature";
188 $tabsql[1] =
"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";
189 $tabsql[2] =
"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";
190 $tabsql[3] =
"SELECT r.rowid as rowid, r.code_region as state_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";
191 $tabsql[4] =
"SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX.
"c_country AS c";
192 $tabsql[5] =
"SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX.
"c_civility AS c";
193 $tabsql[6] =
"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";
194 $tabsql[7] =
"SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.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";
195 $tabsql[8] =
"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.active FROM ".MAIN_DB_PREFIX.
"c_typent as t LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON t.fk_country=c.rowid";
196 $tabsql[9] =
"SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX.
"c_currencies AS c";
197 $tabsql[10] =
"SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c WHERE t.fk_pays=c.rowid";
198 $tabsql[11] =
"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";
199 $tabsql[12] =
"SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, 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 = ".
getEntity($tabname[12]);
200 $tabsql[13] =
"SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_paiement AS c WHERE c.entity = ".
getEntity($tabname[13]);
201 $tabsql[14] =
"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";
202 $tabsql[15] =
"SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX.
"c_paper_format";
203 $tabsql[16] =
"SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
204 $tabsql[17] =
"SELECT id as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX.
"c_type_fees";
205 $tabsql[18] =
"SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX.
"c_shipment_mode";
206 $tabsql[19] =
"SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX.
"c_effectif";
207 $tabsql[20] =
"SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX.
"c_input_method";
208 $tabsql[21] =
"SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_availability AS c";
209 $tabsql[22] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_input_reason";
210 $tabsql[23] =
"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";
211 $tabsql[24] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_type_resource";
212 $tabsql[25] =
"SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX.
"c_type_container as t WHERE t.entity IN (".
getEntity(
'c_type_container').
")";
214 $tabsql[27] =
"SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX.
"c_stcomm";
215 $tabsql[28] =
"SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX.
"c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON h.fk_country=c.rowid";
216 $tabsql[29] =
"SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX.
"c_lead_status";
217 $tabsql[30] =
"SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX.
"c_format_cards";
219 $tabsql[32] =
"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";
220 $tabsql[33] =
"SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX.
"c_hrm_department";
221 $tabsql[34] =
"SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX.
"c_hrm_function";
222 $tabsql[35] =
"SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_exp_tax_cat c";
223 $tabsql[36] =
"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";
224 $tabsql[37] =
"SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX.
"c_units r";
225 $tabsql[38] =
"SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX.
"c_socialnetworks";
226 $tabsql[39] =
"SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
227 $tabsql[40] =
"SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX.
"c_stcommcontact";
228 $tabsql[41] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_transport_mode";
229 $tabsql[42] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_product_nature";
232 $tabsqlsort = array();
233 $tabsqlsort[1] =
"country ASC, code ASC";
234 $tabsqlsort[2] =
"country ASC, code ASC";
235 $tabsqlsort[3] =
"country ASC, code ASC";
236 $tabsqlsort[4] =
"code ASC";
237 $tabsqlsort[5] =
"label ASC";
238 $tabsqlsort[6] =
"a.type ASC, a.module ASC, a.position ASC, a.code ASC";
239 $tabsqlsort[7] =
"c.label ASC, a.code ASC, a.libelle ASC";
240 $tabsqlsort[8] =
"country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
' t.position ASC,' :
'').
" libelle ASC";
241 $tabsqlsort[9] =
"label ASC";
242 $tabsqlsort[10] =
"country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
243 $tabsqlsort[11] =
"t.element ASC, t.source ASC, t.position ASC, t.code ASC";
244 $tabsqlsort[12] =
"sortorder ASC, code ASC";
245 $tabsqlsort[13] =
"code ASC";
246 $tabsqlsort[14] =
"country ASC, e.organization ASC, code ASC";
247 $tabsqlsort[15] =
"rowid ASC";
248 $tabsqlsort[16] =
"sortorder ASC";
249 $tabsqlsort[17] =
"code ASC";
250 $tabsqlsort[18] =
"code ASC, libelle ASC";
251 $tabsqlsort[19] =
"id ASC";
252 $tabsqlsort[20] =
"code ASC, libelle ASC";
253 $tabsqlsort[21] =
"code ASC, label ASC";
254 $tabsqlsort[22] =
"code ASC, label ASC";
255 $tabsqlsort[23] =
"country ASC, taux ASC";
256 $tabsqlsort[24] =
"code ASC, label ASC";
257 $tabsqlsort[25] =
"t.module ASC, t.code ASC, t.label ASC";
259 $tabsqlsort[27] =
"code ASC";
260 $tabsqlsort[28] =
"country ASC, code ASC";
261 $tabsqlsort[29] =
"position ASC";
262 $tabsqlsort[30] =
"code ASC";
264 $tabsqlsort[32] =
"country, year ASC, month ASC, day ASC";
265 $tabsqlsort[33] =
"code ASC";
266 $tabsqlsort[34] =
"code ASC";
267 $tabsqlsort[35] =
"c.label ASC";
268 $tabsqlsort[36] =
"r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
269 $tabsqlsort[37] =
"r.unit_type ASC, r.scale ASC, r.code ASC";
270 $tabsqlsort[38] =
"rowid, code ASC";
271 $tabsqlsort[39] =
"sortorder ASC";
272 $tabsqlsort[40] =
"code ASC";
273 $tabsqlsort[41] =
"code ASC";
274 $tabsqlsort[42] =
"code ASC";
278 $tabfield[1] =
"code,libelle,country";
279 $tabfield[2] =
"code,libelle,region_id,region,country";
280 $tabfield[3] =
"code,libelle,country_id,country";
281 $tabfield[4] =
"code,label";
282 $tabfield[5] =
"code,label";
283 $tabfield[6] =
"code,libelle,type,color,position";
284 $tabfield[7] =
"code,libelle,country,accountancy_code,deductible";
285 $tabfield[8] =
"code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
',position' :
'');
286 $tabfield[9] =
"code,label,unicode";
287 $tabfield[10] =
"country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
288 $tabfield[11] =
"element,source,code,libelle,position";
289 $tabfield[12] =
"code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
290 $tabfield[13] =
"code,libelle,type,entity";
291 $tabfield[14] =
"code,label,price,organization,country";
292 $tabfield[15] =
"code,libelle,width,height,unit";
293 $tabfield[16] =
"code,libelle,sortorder";
294 $tabfield[17] =
"code,label,accountancy_code";
295 $tabfield[18] =
"code,libelle,tracking";
296 $tabfield[19] =
"code,libelle";
297 $tabfield[20] =
"code,libelle";
298 $tabfield[21] =
"code,label";
299 $tabfield[22] =
"code,label";
300 $tabfield[23] =
"country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
301 $tabfield[24] =
"code,label";
302 $tabfield[25] =
"code,label";
304 $tabfield[27] =
"code,libelle,picto";
305 $tabfield[28] =
"code,label,affect,delay,newbymonth,country_id,country";
306 $tabfield[29] =
"code,label,percent,position";
307 $tabfield[30] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
309 $tabfield[32] =
"code,dayrule,year,month,day,country_id,country";
310 $tabfield[33] =
"code,label";
311 $tabfield[34] =
"code,label";
312 $tabfield[35] =
"label";
313 $tabfield[36] =
"range_ik,fk_c_exp_tax_cat";
314 $tabfield[37] =
"code,label,short_label,unit_type,scale";
315 $tabfield[38] =
"code,label,url,icon,entity";
316 $tabfield[39] =
"code,libelle,sortorder";
317 $tabfield[40] =
"code,libelle,picto";
318 $tabfield[41] =
"code,label";
319 $tabfield[42] =
"code,label";
322 $tabfieldvalue = array();
323 $tabfieldvalue[1] =
"code,libelle,country";
324 $tabfieldvalue[2] =
"code,libelle,region";
325 $tabfieldvalue[3] =
"code,libelle,country";
326 $tabfieldvalue[4] =
"code,label";
327 $tabfieldvalue[5] =
"code,label";
328 $tabfieldvalue[6] =
"code,libelle,type,color,position";
329 $tabfieldvalue[7] =
"code,libelle,country,accountancy_code,deductible";
330 $tabfieldvalue[8] =
"code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
',position' :
'');
331 $tabfieldvalue[9] =
"code,label,unicode";
332 $tabfieldvalue[10] =
"country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
333 $tabfieldvalue[11] =
"element,source,code,libelle,position";
334 $tabfieldvalue[12] =
"code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
335 $tabfieldvalue[13] =
"code,libelle,type";
336 $tabfieldvalue[14] =
"code,label,price,organization,country";
337 $tabfieldvalue[15] =
"code,libelle,width,height,unit";
338 $tabfieldvalue[16] =
"code,libelle,sortorder";
339 $tabfieldvalue[17] =
"code,label,accountancy_code";
340 $tabfieldvalue[18] =
"code,libelle,tracking";
341 $tabfieldvalue[19] =
"code,libelle";
342 $tabfieldvalue[20] =
"code,libelle";
343 $tabfieldvalue[21] =
"code,label";
344 $tabfieldvalue[22] =
"code,label";
345 $tabfieldvalue[23] =
"country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
346 $tabfieldvalue[24] =
"code,label";
347 $tabfieldvalue[25] =
"code,label";
349 $tabfieldvalue[27] =
"code,libelle,picto";
350 $tabfieldvalue[28] =
"code,label,affect,delay,newbymonth,country";
351 $tabfieldvalue[29] =
"code,label,percent,position";
352 $tabfieldvalue[30] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
354 $tabfieldvalue[32] =
"code,dayrule,day,month,year,country";
355 $tabfieldvalue[33] =
"code,label";
356 $tabfieldvalue[34] =
"code,label";
357 $tabfieldvalue[35] =
"label";
358 $tabfieldvalue[36] =
"range_ik,fk_c_exp_tax_cat";
359 $tabfieldvalue[37] =
"code,label,short_label,unit_type,scale";
360 $tabfieldvalue[38] =
"code,label,url,icon";
361 $tabfieldvalue[39] =
"code,libelle,sortorder";
362 $tabfieldvalue[40] =
"code,libelle,picto";
363 $tabfieldvalue[41] =
"code,label";
364 $tabfieldvalue[42] =
"code,label";
367 $tabfieldinsert = array();
368 $tabfieldinsert[1] =
"code,libelle,fk_pays";
369 $tabfieldinsert[2] =
"code_departement,nom,fk_region";
370 $tabfieldinsert[3] =
"code_region,nom,fk_pays";
371 $tabfieldinsert[4] =
"code,label";
372 $tabfieldinsert[5] =
"code,label";
373 $tabfieldinsert[6] =
"code,libelle,type,color,position";
374 $tabfieldinsert[7] =
"code,libelle,fk_pays,accountancy_code,deductible";
375 $tabfieldinsert[8] =
"code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
',position' :
'');
376 $tabfieldinsert[9] =
"code_iso,label,unicode";
377 $tabfieldinsert[10] =
"fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
378 $tabfieldinsert[11] =
"element,source,code,libelle,position";
379 $tabfieldinsert[12] =
"code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
380 $tabfieldinsert[13] =
"code,libelle,type,entity";
381 $tabfieldinsert[14] =
"code,label,price,organization,fk_pays";
382 $tabfieldinsert[15] =
"code,label,width,height,unit";
383 $tabfieldinsert[16] =
"code,label,sortorder";
384 $tabfieldinsert[17] =
"code,label,accountancy_code";
385 $tabfieldinsert[18] =
"code,libelle,tracking";
386 $tabfieldinsert[19] =
"code,libelle";
387 $tabfieldinsert[20] =
"code,libelle";
388 $tabfieldinsert[21] =
"code,label";
389 $tabfieldinsert[22] =
"code,label";
390 $tabfieldinsert[23] =
"fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
391 $tabfieldinsert[24] =
"code,label";
392 $tabfieldinsert[25] =
"code,label";
394 $tabfieldinsert[27] =
"code,libelle,picto";
395 $tabfieldinsert[28] =
"code,label,affect,delay,newbymonth,fk_country";
396 $tabfieldinsert[29] =
"code,label,percent,position";
397 $tabfieldinsert[30] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
400 $tabfieldinsert[32] =
"code,dayrule,day,month,year,fk_country";
401 $tabfieldinsert[33] =
"code,label";
402 $tabfieldinsert[34] =
"code,label";
403 $tabfieldinsert[35] =
"label";
404 $tabfieldinsert[36] =
"range_ik,fk_c_exp_tax_cat";
405 $tabfieldinsert[37] =
"code,label,short_label,unit_type,scale";
406 $tabfieldinsert[38] =
"code,label,url,icon,entity";
407 $tabfieldinsert[39] =
"code,label,sortorder";
408 $tabfieldinsert[40] =
"code,libelle,picto";
409 $tabfieldinsert[41] =
"code,label";
410 $tabfieldinsert[42] =
"code,label";
419 $tabrowid[4] =
"rowid";
420 $tabrowid[5] =
"rowid";
424 $tabrowid[9] =
"code_iso";
426 $tabrowid[11] =
"rowid";
428 $tabrowid[13] =
"id";
431 $tabrowid[16] =
"code";
432 $tabrowid[17] =
"id";
433 $tabrowid[18] =
"rowid";
434 $tabrowid[19] =
"id";
436 $tabrowid[21] =
"rowid";
437 $tabrowid[22] =
"rowid";
442 $tabrowid[27] =
"id";
447 $tabrowid[32] =
"id";
448 $tabrowid[33] =
"rowid";
449 $tabrowid[34] =
"rowid";
454 $tabrowid[39] =
"code";
455 $tabrowid[40] =
"id";
457 $tabrowid[42] =
"rowid";
461 $tabcond[1] = (!empty($conf->societe->enabled));
465 $tabcond[5] = (!empty($conf->societe->enabled) || !empty($conf->adherent->enabled));
466 $tabcond[6] = !empty($conf->agenda->enabled);
467 $tabcond[7] = !empty($conf->tax->enabled);
468 $tabcond[8] = !empty($conf->societe->enabled);
471 $tabcond[11] = (!empty($conf->societe->enabled));
472 $tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled));
473 $tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled));
474 $tabcond[14] = (!empty($conf->product->enabled) && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
476 $tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
477 $tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled));
478 $tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled);
479 $tabcond[19] = !empty($conf->societe->enabled);
480 $tabcond[20] = (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled));
481 $tabcond[21] = !empty($conf->propal->enabled);
482 $tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled));
484 $tabcond[24] = !empty($conf->resource->enabled);
485 $tabcond[25] = !empty($conf->website->enabled);
487 $tabcond[27] = !empty($conf->societe->enabled);
488 $tabcond[28] = !empty($conf->holiday->enabled);
489 $tabcond[29] = !empty($conf->projet->enabled);
490 $tabcond[30] = !empty($conf->label->enabled);
492 $tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled));
493 $tabcond[33] = !empty($conf->hrm->enabled);
494 $tabcond[34] = !empty($conf->hrm->enabled);
495 $tabcond[35] = !empty($conf->expensereport->enabled);
496 $tabcond[36] = !empty($conf->expensereport->enabled);
497 $tabcond[37] = !empty($conf->product->enabled);
498 $tabcond[38] = !empty($conf->socialnetworks->enabled);
499 $tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
500 $tabcond[40] = (!empty($conf->societe->enabled) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
501 $tabcond[41] = !empty($conf->intracommreport->enabled);
502 $tabcond[42] = !empty($conf->product->enabled);
506 $tabhelp[1] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
507 $tabhelp[2] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
508 $tabhelp[3] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
509 $tabhelp[4] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
510 $tabhelp[5] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
511 $tabhelp[6] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'color'=>$langs->trans(
"ColorFormat"),
'position'=>$langs->trans(
"PositionIntoComboList"));
512 $tabhelp[7] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
513 $tabhelp[8] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'position'=>$langs->trans(
"PositionIntoComboList"));
514 $tabhelp[9] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'unicode'=>$langs->trans(
"UnicodeCurrency"));
515 $tabhelp[10] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'taux'=>$langs->trans(
"SellTaxRate"),
'recuperableonly'=>$langs->trans(
"RecuperableOnly"),
'localtax1_type'=>$langs->trans(
"LocalTaxDesc"),
'localtax2_type'=>$langs->trans(
"LocalTaxDesc"));
516 $tabhelp[11] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'position'=>$langs->trans(
"PositionIntoComboList"));
517 $tabhelp[12] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'type_cdr'=>$langs->trans(
"TypeCdr", $langs->transnoentitiesnoconv(
"NbOfDays"), $langs->transnoentitiesnoconv(
"Offset"), $langs->transnoentitiesnoconv(
"NbOfDays"), $langs->transnoentitiesnoconv(
"Offset")));
518 $tabhelp[13] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
519 $tabhelp[14] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
520 $tabhelp[15] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
521 $tabhelp[16] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
522 $tabhelp[17] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
523 $tabhelp[18] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'tracking'=>$langs->trans(
"UrlTrackingDesc"));
524 $tabhelp[19] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
525 $tabhelp[20] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
526 $tabhelp[21] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
527 $tabhelp[22] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
528 $tabhelp[23] = array(
'revenuestamp_type'=>
'FixedOrPercent');
529 $tabhelp[24] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
530 $tabhelp[25] = array(
'code'=>$langs->trans(
'EnterAnyCode'));
532 $tabhelp[27] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'picto'=>$langs->trans(
"PictoHelp"));
533 $tabhelp[28] = array(
'affect'=>$langs->trans(
"FollowedByACounter"),
'delay'=>$langs->trans(
"MinimumNoticePeriod"),
'newbymonth'=>$langs->trans(
"NbAddedAutomatically"));
534 $tabhelp[29] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'percent'=>$langs->trans(
"OpportunityPercent"),
'position'=>$langs->trans(
"PositionIntoComboList"));
535 $tabhelp[30] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'name'=>$langs->trans(
"LabelName"),
'paper_size'=>$langs->trans(
"LabelPaperSize"));
537 $tabhelp[32] = 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"));
538 $tabhelp[33] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
539 $tabhelp[34] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
540 $tabhelp[35] = array();
541 $tabhelp[36] = array(
'range_ik'=>$langs->trans(
'PrevRangeToThisRange'));
542 $tabhelp[37] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'unit_type' => $langs->trans(
'MeasuringUnitTypeDesc'),
'scale' => $langs->trans(
'MeasuringScaleDesc'));
543 $tabhelp[38] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'url' => $langs->trans(
'UrlSocialNetworksDesc'),
'icon' => $langs->trans(
'FafaIconSocialNetworksDesc'));
544 $tabhelp[39] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
545 $tabhelp[40] = array(
'code'=>$langs->trans(
"EnterAnyCode"),
'picto'=>$langs->trans(
"PictoHelp"));
546 $tabhelp[41] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
547 $tabhelp[42] = array(
'code'=>$langs->trans(
"EnterAnyCode"));
550 $tabfieldcheck = array();
551 $tabfieldcheck[1] = array();
552 $tabfieldcheck[2] = array();
553 $tabfieldcheck[3] = array();
554 $tabfieldcheck[4] = array();
555 $tabfieldcheck[5] = array();
556 $tabfieldcheck[6] = array();
557 $tabfieldcheck[7] = array();
558 $tabfieldcheck[8] = array();
559 $tabfieldcheck[9] = array();
560 $tabfieldcheck[10] = array();
561 $tabfieldcheck[11] = array();
562 $tabfieldcheck[12] = array();
563 $tabfieldcheck[13] = array();
564 $tabfieldcheck[14] = array();
565 $tabfieldcheck[15] = array();
566 $tabfieldcheck[16] = array();
567 $tabfieldcheck[17] = array();
568 $tabfieldcheck[18] = array();
569 $tabfieldcheck[19] = array();
570 $tabfieldcheck[20] = array();
571 $tabfieldcheck[21] = array();
572 $tabfieldcheck[22] = array();
573 $tabfieldcheck[23] = array();
574 $tabfieldcheck[24] = array();
575 $tabfieldcheck[25] = array();
577 $tabfieldcheck[27] = array();
578 $tabfieldcheck[28] = array();
579 $tabfieldcheck[29] = array();
580 $tabfieldcheck[30] = array();
582 $tabfieldcheck[32] = array();
583 $tabfieldcheck[33] = array();
584 $tabfieldcheck[34] = array();
585 $tabfieldcheck[35] = array();
586 $tabfieldcheck[36] = array();
587 $tabfieldcheck[37] = array();
588 $tabfieldcheck[38] = array();
589 $tabfieldcheck[39] = array();
590 $tabfieldcheck[40] = array();
591 $tabfieldcheck[41] = array();
592 $tabfieldcheck[42] = array();
595 complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
599 if (empty($sortfield))
601 $tmp1 = explode(
',', $tabsqlsort[$id]);
602 $tmp2 = explode(
' ', $tmp1[0]);
603 $sortfield = preg_replace(
'/^.*\./',
'', $tmp2[0]);
607 $elementList = array();
608 $sourceList = array();
611 $elementList = array(
613 'societe' => $langs->trans(
'ThirdParty'),
617 'supplier_proposal' => $langs->trans(
'SupplierProposal'),
618 'order_supplier' => $langs->trans(
'SupplierOrder'),
619 'invoice_supplier' => $langs->trans(
'SupplierBill'),
622 'project' => $langs->trans(
'Project'),
623 'project_task' => $langs->trans(
'Task'),
624 'ticket' => $langs->trans(
'Ticket'),
625 'agenda' => $langs->trans(
'Agenda'),
626 'dolresource' => $langs->trans(
'Resource'),
628 'propal' => $langs->trans(
'Proposal'),
629 'commande' => $langs->trans(
'Order'),
630 'facture' => $langs->trans(
'Bill'),
631 'fichinter' => $langs->trans(
'InterventionCard'),
632 'contrat' => $langs->trans(
'Contract'),
634 if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList[
"societe"] = $langs->trans(
'ThirdParty');
640 'internal' => $langs->trans(
'Internal'),
641 'external' => $langs->trans(
'External')
646 $localtax_typeList = array();
649 $localtax_typeList = array(
650 "0" => $langs->trans(
"No"),
651 "1" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 1)",
652 "2" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 2)",
653 "3" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 3)",
654 "4" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 4)",
655 "5" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 5)",
656 "6" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 6)"
666 if (
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha'))
668 $search_country_id =
'';
675 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
676 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
677 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
678 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
682 foreach ($listfield as $f => $value)
685 if ($value ==
'country_id' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryVAT',
'DictionaryRegion',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp',
'DictionaryAccountancysystem',
'DictionaryAccountancyCategory')))
continue;
686 if ($value ==
'country' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryCanton',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp')))
continue;
688 if ($value ==
'localtax1' && empty($_POST[
'localtax1_type']))
continue;
689 if ($value ==
'localtax2' && empty($_POST[
'localtax2_type']))
continue;
690 if ($value ==
'color' && empty($_POST[
'color']))
continue;
691 if ($value ==
'formula' && empty($_POST[
'formula']))
continue;
692 if ($value ==
'dayrule' && empty($_POST[
'dayrule']))
continue;
693 if ($value ==
'sortorder')
continue;
695 && (!in_array($listfield[$f], array(
'decalage',
'module',
'accountancy_code',
'accountancy_code_sell',
'accountancy_code_buy',
'tracking',
'picto'))
696 && ($id != 10 || ($listfield[$f] !=
'code' && $listfield[$f] !=
'note'))
700 $fieldnamekey = $listfield[$f];
702 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) $fieldnamekey =
'Label';
703 if ($fieldnamekey ==
'libelle_facture') $fieldnamekey =
'LabelOnDocuments';
704 if ($fieldnamekey ==
'nbjour') $fieldnamekey =
'NbOfDays';
705 if ($fieldnamekey ==
'decalage') $fieldnamekey =
'Offset';
706 if ($fieldnamekey ==
'module') $fieldnamekey =
'Module';
707 if ($fieldnamekey ==
'code') $fieldnamekey =
'Code';
708 if ($fieldnamekey ==
'note') $fieldnamekey =
'Note';
709 if ($fieldnamekey ==
'taux') $fieldnamekey =
'Rate';
710 if ($fieldnamekey ==
'type') $fieldnamekey =
'Type';
711 if ($fieldnamekey ==
'position') $fieldnamekey =
'Position';
712 if ($fieldnamekey ==
'unicode') $fieldnamekey =
'Unicode';
713 if ($fieldnamekey ==
'deductible') $fieldnamekey =
'Deductible';
714 if ($fieldnamekey ==
'sortorder') $fieldnamekey =
'SortOrder';
715 if ($fieldnamekey ==
'category_type') $fieldnamekey =
'Calculated';
716 if ($fieldnamekey ==
'revenuestamp_type') $fieldnamekey =
'TypeOfRevenueStamp';
717 if ($fieldnamekey ==
'use_default') $fieldnamekey =
'UseByDefault';
719 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null,
'errors');
723 if (
GETPOST(
'actionadd') && $tabname[$id] == MAIN_DB_PREFIX.
"c_actioncomm" &&
GETPOSTISSET(
"type") && in_array(
GETPOST(
"type"), array(
'system',
'systemauto'))) {
725 setEventMessages($langs->transnoentities(
'ErrorReservedTypeSystemSystemAuto'), null,
'errors');
732 setEventMessages($langs->transnoentities(
'ErrorCodeCantContainZero'), null,
'errors');
740 if (
GETPOSTISSET(
"country") && ($_POST[
"country"] ==
'0') && ($id != 2))
742 if (in_array($tablib[$id], array(
'DictionaryCompanyType',
'DictionaryHolidayTypes')))
744 $_POST[
"country"] =
'';
747 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities(
"Country")), null,
'errors');
750 if (($id == 3 || $id == 42) && !is_numeric($_POST[
"code"])) {
752 setEventMessages($langs->transnoentities(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Code")), null,
'errors');
756 if ((!empty($_POST[
"localtax1_type"]) || ($_POST[
'localtax1_type'] ==
'0')) && empty($_POST[
"localtax1"])) $_POST[
"localtax1"] =
'0';
757 if ((!empty($_POST[
"localtax2_type"]) || ($_POST[
'localtax2_type'] ==
'0')) && empty($_POST[
"localtax2"])) $_POST[
"localtax2"] =
'0';
758 if ($_POST[
"accountancy_code"] <= 0) $_POST[
"accountancy_code"] =
'';
759 if ($_POST[
"accountancy_code_sell"] <= 0) $_POST[
"accountancy_code_sell"] =
'';
760 if ($_POST[
"accountancy_code_buy"] <= 0) $_POST[
"accountancy_code_buy"] =
'';
763 $_POST[
"code"] = preg_replace(
'/[^a-zA-Z0-9\-\+]/',
'', $_POST[
"code"]);
767 if ($ok &&
GETPOST(
'actionadd'))
773 $sql =
"SELECT max(".$tabrowid[$id].
") newid from ".$tabname[$id];
774 $result = $db->query($sql);
777 $obj = $db->fetch_object($result);
778 $newid = ($obj->newid + 1);
785 $sql =
"INSERT INTO ".$tabname[$id].
" (";
787 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
788 $sql .= $tabrowid[$id].
",";
789 $sql .= $tabfieldinsert[$id];
794 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
797 foreach ($listfieldinsert as $f => $value)
799 $keycode = $listfieldvalue[$i];
800 if (empty($keycode)) $keycode = $value;
802 if ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
805 elseif ($value ==
'taux' || $value ==
'localtax1' || $value ==
'localtax2') {
808 elseif ($value ==
'entity') {
809 $_POST[$keycode] =
getEntity($tabname[$id]);
814 if ($keycode ==
'sortorder')
816 $sql .=
"'".(int)
GETPOST(
'position',
'int').
"'";
817 } elseif ($_POST[$keycode] ==
'' && !($keycode ==
'code' && $id == 10)) $sql .= "null";
818 elseif ($keycode == 'content') {
819 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
820 } elseif (in_array($keycode, array(
'joinfile',
'private',
'position',
'scale'))) {
821 $sql .= (int)
GETPOST($keycode,
'int');
823 $sql .=
"'".$db->escape(
GETPOST($keycode,
'nohtml')).
"'";
831 $result = $db->query($sql);
834 setEventMessages($langs->transnoentities(
"RecordCreatedSuccessfully"), null,
'mesgs');
837 if ($id == 10 &&
GETPOST(
'country',
'int') > 0) {
838 $search_country_id =
GETPOST(
'country',
'int');
840 $_POST = array(
'id'=>$id);
842 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
843 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"), null,
'errors');
851 if ($ok &&
GETPOST(
'actionmodify'))
853 if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol =
"rowid"; }
856 $sql =
"UPDATE ".$tabname[$id].
" SET ";
858 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
860 $sql .= $tabrowid[$id].
"=";
861 $sql .=
"'".$db->escape($rowid).
"', ";
864 foreach ($listfieldmodify as $field)
866 $keycode = $listfieldvalue[$i];
867 if (empty($keycode)) $keycode = $field;
869 if ($field ==
'price' || preg_match(
'/^amount/i', $field)) {
872 elseif ($field ==
'taux' || $field ==
'localtax1' || $field ==
'localtax2') {
875 elseif ($field ==
'entity') {
876 $_POST[$keycode] =
getEntity($tabname[$id]);
881 if ($listfieldvalue[$i] ==
'sortorder')
883 $sql .= (int)
GETPOST(
'position',
'int');
884 } elseif ($_POST[$keycode] ==
'' && !($keycode ==
'code' && $id == 10)) $sql .= "null";
885 elseif ($keycode == 'content') {
886 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
887 } elseif (in_array($keycode, array(
'private',
'position',
'scale'))) {
888 $sql .= (int)
GETPOST($keycode,
'int');
890 $sql .=
"'".$db->escape(
GETPOST($keycode,
'nohtml')).
"'";
895 if (in_array($rowidcol, array(
'code',
'code_iso'))) {
896 $sql .=
" WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'";
898 $sql .=
" WHERE ".$rowidcol.
" = ".((int) $rowid);
900 if (in_array(
'entity', $listfieldmodify)) $sql .=
" AND entity = '".
getEntity($tabname[$id]).
"'";
904 $resql = $db->query($sql);
918 if ($action ==
'confirm_delete' && $confirm ==
'yes')
920 if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol =
"rowid"; }
922 $sql =
"DELETE FROM ".$tabname[$id].
" WHERE ".$rowidcol.
"='".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
925 $result = $db->query($sql);
928 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS')
930 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"), null,
'errors');
938 if ($action == $acts[0])
940 if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol =
"rowid"; }
943 $sql =
"UPDATE ".$tabname[$id].
" SET active = 1 WHERE ".$rowidcol.
"='".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
945 $sql =
"UPDATE ".$tabname[$id].
" SET active = 1 WHERE code='".
dol_escape_htmltag($code).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
948 $result = $db->query($sql);
956 if ($action == $acts[1])
958 if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol =
"rowid"; }
961 $sql =
"UPDATE ".$tabname[$id].
" SET active = 0 WHERE ".$rowidcol.
"='".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
963 $sql =
"UPDATE ".$tabname[$id].
" SET active = 0 WHERE code='".
dol_escape_htmltag($code).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
966 $result = $db->query($sql);
974 if ($action ==
'activate_favorite')
976 if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol =
"rowid"; }
979 $sql =
"UPDATE ".$tabname[$id].
" SET favorite = 1 WHERE ".$rowidcol.
"='".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
981 $sql =
"UPDATE ".$tabname[$id].
" SET favorite = 1 WHERE code='".
dol_escape_htmltag($code).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
984 $result = $db->query($sql);
992 if ($action ==
'disable_favorite')
994 if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol =
"rowid"; }
997 $sql =
"UPDATE ".$tabname[$id].
" SET favorite = 0 WHERE ".$rowidcol.
"='".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
999 $sql =
"UPDATE ".$tabname[$id].
" SET favorite = 0 WHERE code='".
dol_escape_htmltag($code).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1002 $result = $db->query($sql);
1014 $form =
new Form($db);
1017 $title = $langs->trans(
"DictionarySetup");
1024 $title .=
' - '.$langs->trans($tablib[$id]);
1025 $linkback =
'<a href="'.$_SERVER[
'PHP_SELF'].
'">'.$langs->trans(
"BackToDictionaryList").
'</a>';
1027 $titlepicto =
'title_setup';
1028 if ($id == 10 &&
GETPOST(
'from') ==
'accountancy')
1030 $title = $langs->trans(
"MenuVatAccounts");
1031 $titlepicto =
'accountancy';
1033 if ($id == 7 &&
GETPOST(
'from') ==
'accountancy')
1035 $title = $langs->trans(
"MenuTaxAccounts");
1036 $titlepicto =
'accountancy';
1043 print '<span class="opacitymedium">'.$langs->trans(
"DictionaryDesc");
1044 print " ".$langs->trans(
"OnlyActiveElementsAreShown").
"<br>\n";
1045 print '</span><br>';
1049 $param =
'&id='.urlencode($id);
1050 if ($search_country_id > 0) $param .=
'&search_country_id='.urlencode($search_country_id);
1051 if ($search_code !=
'') $param .=
'&search_code='.urlencode($search_country_id);
1052 if ($entity !=
'') $param .=
'&entity='.(int) $entity;
1053 $paramwithsearch = $param;
1054 if ($sortorder) $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
1055 if ($sortfield) $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
1056 if (
GETPOST(
'from')) $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
1060 if ($action ==
'delete')
1062 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);
1072 $sql = $tabsql[$id];
1074 if (!preg_match(
'/ WHERE /', $sql)) $sql .=
" WHERE 1 = 1";
1075 if ($search_country_id > 0) $sql .=
" AND c.rowid = ".$search_country_id;
1076 if ($search_code !=
'' && $id == 9) $sql .=
natural_search(
"code_iso", $search_code);
1077 elseif ($search_code !=
'' && $id == 28) $sql .=
natural_search("h.
code", $search_code);
1078 elseif ($search_code != '' && $id == 32) $sql .=
natural_search("a.code", $search_code);
1079 elseif ($search_code != '' && $id == 3) $sql .=
natural_search("r.code_region", $search_code);
1080 elseif ($search_code != '' && $id == 7) $sql .=
natural_search("a.code", $search_code);
1081 elseif ($search_code != '' && $id != 9) $sql .=
natural_search("code", $search_code);
1086 if ($sortfield ==
'country') $sortfield =
'country_code';
1087 $sql .= $db->order($sortfield, $sortorder);
1090 $tabsqlsort[$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
' '.$sortorder.
',/i',
'', $tabsqlsort[$id]);
1091 $tabsqlsort[$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
',/i',
'', $tabsqlsort[$id]);
1093 $sql .=
" ORDER BY ";
1095 $sql .= $tabsqlsort[$id];
1096 $sql .= $db->plimit($listlimit + 1, $offset);
1099 if (empty($tabfield[$id]))
1101 dol_print_error($db,
'The table with id '.$id.
' has no array tabfield defined');
1104 $fieldlist = explode(
',', $tabfield[$id]);
1106 print '<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
1107 print '<input type="hidden" name="token" value="'.newToken().
'">';
1108 print '<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
1110 if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION))
1112 print info_admin($langs->trans(
"VATIsUsedIsOff", $langs->transnoentities(
"Setup"), $langs->transnoentities(
"CompanyFoundation")));
1121 $fieldlist = explode(
',', $tabfield[$id]);
1123 print '<div class="div-table-responsive-no-min">';
1124 print '<table class="noborder centpercent">';
1127 $tdsoffields =
'<tr class="liste_titre">';
1128 foreach ($fieldlist as $field => $value)
1130 if ($fieldlist[$field] ==
'entity') {
1136 $valuetoshow = ucfirst($fieldlist[$field]);
1137 $valuetoshow = $langs->trans($valuetoshow);
1140 if ($fieldlist[$field] ==
'pos') { $valuetoshow = $langs->trans(
"Position"); $class =
'maxwidth100'; }
1141 if ($fieldlist[$field] ==
'source') { $valuetoshow = $langs->trans(
"Contact"); }
1142 if ($fieldlist[$field] ==
'price') { $valuetoshow = $langs->trans(
"PriceUHT"); }
1143 if ($fieldlist[$field] ==
'taux') {
1144 if ($tabname[$id] != MAIN_DB_PREFIX.
"c_revenuestamp") $valuetoshow = $langs->trans(
"Rate");
1145 else $valuetoshow = $langs->trans(
"Amount");
1148 if ($fieldlist[$field] ==
'localtax1_type') { $valuetoshow = $langs->trans(
"UseLocalTax").
" 2"; $class =
"center"; $sortable = 0; }
1149 if ($fieldlist[$field] ==
'localtax1') { $valuetoshow = $langs->trans(
"Rate").
" 2"; $class =
"center"; }
1150 if ($fieldlist[$field] ==
'localtax2_type') { $valuetoshow = $langs->trans(
"UseLocalTax").
" 3"; $class =
"center"; $sortable = 0; }
1151 if ($fieldlist[$field] ==
'localtax2') { $valuetoshow = $langs->trans(
"Rate").
" 3"; $class =
"center"; }
1152 if ($fieldlist[$field] ==
'organization') { $valuetoshow = $langs->trans(
"Organization"); }
1153 if ($fieldlist[$field] ==
'lang') { $valuetoshow = $langs->trans(
"Language"); }
1154 if ($fieldlist[$field] ==
'type') {
1155 if ($tabname[$id] == MAIN_DB_PREFIX.
"c_paiement") $valuetoshow = $form->textwithtooltip($langs->trans(
"Type"), $langs->trans(
"TypePaymentDesc"), 2, 1,
img_help(1,
''));
1156 else $valuetoshow = $langs->trans(
"Type");
1158 if ($fieldlist[$field] ==
'code') { $valuetoshow = $langs->trans(
"Code"); $class =
'maxwidth100'; }
1159 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label')
1161 $valuetoshow = $form->textwithtooltip($langs->trans(
"Label"), $langs->trans(
"LabelUsedByDefault"), 2, 1,
img_help(1,
''));
1163 if ($fieldlist[$field] ==
'libelle_facture') {
1164 $valuetoshow = $form->textwithtooltip($langs->trans(
"LabelOnDocuments"), $langs->trans(
"LabelUsedByDefault"), 2, 1,
img_help(1,
''));
1166 if ($fieldlist[$field] ==
'country') {
1167 if (in_array(
'region_id', $fieldlist)) {
print '<td> </td>';
continue; }
1168 $valuetoshow = $langs->trans(
"Country");
1170 if ($fieldlist[$field] ==
'recuperableonly') { $valuetoshow = $langs->trans(
"NPR"); $class =
"center"; }
1171 if ($fieldlist[$field] ==
'nbjour') { $valuetoshow = $langs->trans(
"NbOfDays"); }
1172 if ($fieldlist[$field] ==
'type_cdr') { $valuetoshow = $langs->trans(
"AtEndOfMonth"); $class =
"center"; }
1173 if ($fieldlist[$field] ==
'decalage') { $valuetoshow = $langs->trans(
"Offset"); }
1174 if ($fieldlist[$field] ==
'width' || $fieldlist[$field] ==
'nx') { $valuetoshow = $langs->trans(
"Width"); }
1175 if ($fieldlist[$field] ==
'height' || $fieldlist[$field] ==
'ny') { $valuetoshow = $langs->trans(
"Height"); }
1176 if ($fieldlist[$field] ==
'unit' || $fieldlist[$field] ==
'metric') { $valuetoshow = $langs->trans(
"MeasuringUnit"); }
1177 if ($fieldlist[$field] ==
'region_id' || $fieldlist[$field] ==
'country_id') { $valuetoshow =
''; }
1178 if ($fieldlist[$field] ==
'accountancy_code') { $valuetoshow = $langs->trans(
"AccountancyCode"); }
1179 if ($fieldlist[$field] ==
'accountancy_code_sell') { $valuetoshow = $langs->trans(
"AccountancyCodeSell"); }
1180 if ($fieldlist[$field] ==
'accountancy_code_buy') { $valuetoshow = $langs->trans(
"AccountancyCodeBuy"); }
1181 if ($fieldlist[$field] ==
'pcg_version' || $fieldlist[$field] ==
'fk_pcg_version') { $valuetoshow = $langs->trans(
"Pcg_version"); }
1182 if ($fieldlist[$field] ==
'account_parent') { $valuetoshow = $langs->trans(
"Accountparent"); }
1183 if ($fieldlist[$field] ==
'pcg_type') { $valuetoshow = $langs->trans(
"Pcg_type"); }
1184 if ($fieldlist[$field] ==
'pcg_subtype') { $valuetoshow = $langs->trans(
"Pcg_subtype"); }
1185 if ($fieldlist[$field] ==
'sortorder') { $valuetoshow = $langs->trans(
"SortOrder"); }
1186 if ($fieldlist[$field] ==
'short_label') { $valuetoshow = $langs->trans(
"ShortLabel"); }
1187 if ($fieldlist[$field] ==
'range_account') { $valuetoshow = $langs->trans(
"Range"); }
1188 if ($fieldlist[$field] ==
'sens') { $valuetoshow = $langs->trans(
"Sens"); }
1189 if ($fieldlist[$field] ==
'category_type') { $valuetoshow = $langs->trans(
"Calculated"); }
1190 if ($fieldlist[$field] ==
'formula') { $valuetoshow = $langs->trans(
"Formula"); }
1191 if ($fieldlist[$field] ==
'paper_size') { $valuetoshow = $langs->trans(
"PaperSize"); }
1192 if ($fieldlist[$field] ==
'orientation') { $valuetoshow = $langs->trans(
"Orientation"); }
1193 if ($fieldlist[$field] ==
'leftmargin') { $valuetoshow = $langs->trans(
"LeftMargin"); }
1194 if ($fieldlist[$field] ==
'topmargin') { $valuetoshow = $langs->trans(
"TopMargin"); }
1195 if ($fieldlist[$field] ==
'spacex') { $valuetoshow = $langs->trans(
"SpaceX"); }
1196 if ($fieldlist[$field] ==
'spacey') { $valuetoshow = $langs->trans(
"SpaceY"); }
1197 if ($fieldlist[$field] ==
'font_size') { $valuetoshow = $langs->trans(
"FontSize"); }
1198 if ($fieldlist[$field] ==
'custom_x') { $valuetoshow = $langs->trans(
"CustomX"); }
1199 if ($fieldlist[$field] ==
'custom_y') { $valuetoshow = $langs->trans(
"CustomY"); }
1200 if ($fieldlist[$field] ==
'percent') { $valuetoshow = $langs->trans(
"Percentage"); }
1201 if ($fieldlist[$field] ==
'affect') { $valuetoshow = $langs->trans(
"WithCounter"); }
1202 if ($fieldlist[$field] ==
'delay') { $valuetoshow = $langs->trans(
"NoticePeriod"); }
1203 if ($fieldlist[$field] ==
'newbymonth') { $valuetoshow = $langs->trans(
"NewByMonth"); }
1204 if ($fieldlist[$field] ==
'fk_tva') { $valuetoshow = $langs->trans(
"VAT"); }
1205 if ($fieldlist[$field] ==
'range_ik') { $valuetoshow = $langs->trans(
"RangeIk"); }
1206 if ($fieldlist[$field] ==
'fk_c_exp_tax_cat') { $valuetoshow = $langs->trans(
"CarCategory"); }
1207 if ($fieldlist[$field] ==
'revenuestamp_type') { $valuetoshow = $langs->trans(
'TypeOfRevenueStamp'); }
1208 if ($fieldlist[$field] ==
'use_default') { $valuetoshow = $langs->trans(
'Default'); $class =
'center'; }
1209 if ($fieldlist[$field] ==
'unit_type') { $valuetoshow = $langs->trans(
'TypeOfUnit'); }
1213 if ($fieldlist[$field] ==
'region_id') { $valuetoshow =
' '; $showfield = 1; }
1214 if ($fieldlist[$field] ==
'region') { $valuetoshow = $langs->trans(
"Country").
'/'.$langs->trans(
"Region"); $showfield = 1; }
1217 if ($valuetoshow !=
'')
1219 $tdsoffields .=
'<td'.($class ?
' class="'.$class.
'"' :
'').
'>';
1220 if (!empty($tabhelp[$id][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[$id][$value])) $tdsoffields .=
'<a href="'.$tabhelp[$id][$value].
'" target="_blank">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
1221 elseif (!empty($tabhelp[$id][$value])) $tdsoffields .= $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1222 else $tdsoffields .= $valuetoshow;
1223 $tdsoffields .=
'</td>';
1227 if ($id == 4) $tdsoffields .=
'<td></td>';
1228 $tdsoffields .=
'<td>';
1229 $tdsoffields .=
'<input type="hidden" name="id" value="'.$id.
'">';
1230 if (!is_null($withentity))
1231 $tdsoffields .=
'<input type="hidden" name="entity" value="'.$withentity.
'">';
1232 $tdsoffields .=
'</td>';
1233 $tdsoffields .=
'<td style="min-width: 26px;"></td>';
1234 $tdsoffields .=
'<td style="min-width: 26px;"></td>';
1235 $tdsoffields .=
'</tr>';
1240 $obj =
new stdClass();
1244 foreach ($fieldlist as $key=>$val)
1251 $tmpaction =
'create';
1252 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1253 $reshook = $hookmanager->executeHooks(
'createDictionaryFieldlist', $parameters, $obj, $tmpaction);
1254 $error = $hookmanager->error; $errors = $hookmanager->errors;
1256 if ($id == 3) unset($fieldlist[2]);
1259 print '<!-- line to add new entry -->';
1260 print '<tr class="oddeven nodrag nodrop nohover">';
1262 if (empty($reshook))
1264 fieldList($fieldlist, $obj, $tabname[$id],
'add');
1267 if ($id == 4)
print '<td></td>';
1268 print '<td colspan="3" class="center">';
1269 if ($action !=
'edit')
1271 print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans(
"Add").
'">';
1287 print '<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
1288 print '<input type="hidden" name="token" value="'.newToken().
'">';
1289 print '<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
1294 $resql = $db->query($sql);
1297 $num = $db->num_rows(
$resql);
1301 if ($num > $listlimit || $page)
1303 print_fleche_navigation($page,
$_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
1304 print '<div class="clearboth"></div>';
1307 print '<div class="div-table-responsive">';
1308 print '<table class="noborder centpercent">';
1311 print '<tr class="liste_titre_filter">';
1313 foreach ($fieldlist as $field => $value)
1315 if ($fieldlist[$field] ==
'entity')
continue;
1319 if ($fieldlist[$field] ==
'region_id' || $fieldlist[$field] ==
'country_id') { $showfield = 0; }
1323 if ($value ==
'country')
1325 print '<td class="liste_titre">';
1326 print $form->select_country($search_country_id,
'search_country_id',
'', 28,
'maxwidth150 maxwidthonsmartphone');
1329 } elseif ($value ==
'code')
1331 print '<td class="liste_titre">';
1332 print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).
'">';
1336 print '<td class="liste_titre">';
1341 if ($id == 4)
print '<td></td>';
1342 print '<td class="liste_titre"></td>';
1343 print '<td class="liste_titre right" colspan="2">';
1346 $searchpicto = $form->showFilterAndCheckAddButtons(0);
1353 print '<tr class="liste_titre">';
1354 foreach ($fieldlist as $field => $value)
1356 if ($fieldlist[$field] ==
'entity')
continue;
1358 if (in_array($value, array(
'label',
'libelle',
'libelle_facture')) && empty($tabhelp[$id][$value])) {
1359 $tabhelp[$id][$value] = $langs->trans(
'LabelUsedByDefault');
1367 $valuetoshow = ucfirst($fieldlist[$field]);
1368 $valuetoshow = $langs->trans($valuetoshow);
1371 if ($fieldlist[$field] ==
'source') { $valuetoshow = $langs->trans(
"Contact"); }
1372 if ($fieldlist[$field] ==
'price') { $valuetoshow = $langs->trans(
"PriceUHT"); }
1373 if ($fieldlist[$field] ==
'taux') {
1374 if ($tabname[$id] != MAIN_DB_PREFIX.
"c_revenuestamp") $valuetoshow = $langs->trans(
"Rate");
1375 else $valuetoshow = $langs->trans(
"Amount");
1376 $cssprefix =
'center ';
1378 if ($fieldlist[$field] ==
'localtax1_type') { $valuetoshow = $langs->trans(
"UseLocalTax").
" 2"; $cssprefix =
"center "; $sortable = 0; }
1379 if ($fieldlist[$field] ==
'localtax1') { $valuetoshow = $langs->trans(
"Rate").
" 2"; $cssprefix =
"center "; $sortable = 0; }
1380 if ($fieldlist[$field] ==
'localtax2_type') { $valuetoshow = $langs->trans(
"UseLocalTax").
" 3"; $cssprefix =
"center "; $sortable = 0; }
1381 if ($fieldlist[$field] ==
'localtax2') { $valuetoshow = $langs->trans(
"Rate").
" 3"; $cssprefix =
"center "; $sortable = 0; }
1382 if ($fieldlist[$field] ==
'organization') { $valuetoshow = $langs->trans(
"Organization"); }
1383 if ($fieldlist[$field] ==
'lang') { $valuetoshow = $langs->trans(
"Language"); }
1384 if ($fieldlist[$field] ==
'type') { $valuetoshow = $langs->trans(
"Type"); }
1385 if ($fieldlist[$field] ==
'code') { $valuetoshow = $langs->trans(
"Code"); }
1386 if ($fieldlist[$field] ==
'pos') { $cssprefix =
'right '; $valuetoshow = $langs->trans(
"Position"); }
1387 if ($fieldlist[$field] ==
'position') { $cssprefix =
'right '; $valuetoshow = $langs->trans(
"Position"); }
1388 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') { $valuetoshow = $langs->trans(
"Label"); }
1389 if ($fieldlist[$field] ==
'libelle_facture') { $valuetoshow = $langs->trans(
"LabelOnDocuments"); }
1390 if ($fieldlist[$field] ==
'country') { $valuetoshow = $langs->trans(
"Country"); }
1391 if ($fieldlist[$field] ==
'recuperableonly') { $valuetoshow = $langs->trans(
"NPR"); $cssprefix =
"center "; }
1392 if ($fieldlist[$field] ==
'nbjour') { $valuetoshow = $langs->trans(
"NbOfDays"); }
1393 if ($fieldlist[$field] ==
'type_cdr') { $valuetoshow = $langs->trans(
"AtEndOfMonth"); $cssprefix =
"center "; }
1394 if ($fieldlist[$field] ==
'decalage') { $valuetoshow = $langs->trans(
"Offset"); }
1395 if ($fieldlist[$field] ==
'width' || $fieldlist[$field] ==
'nx') { $valuetoshow = $langs->trans(
"Width"); }
1396 if ($fieldlist[$field] ==
'height' || $fieldlist[$field] ==
'ny') { $valuetoshow = $langs->trans(
"Height"); }
1397 if ($fieldlist[$field] ==
'unit' || $fieldlist[$field] ==
'metric') { $valuetoshow = $langs->trans(
"MeasuringUnit"); }
1398 if ($fieldlist[$field] ==
'accountancy_code') { $valuetoshow = $langs->trans(
"AccountancyCode"); }
1399 if ($fieldlist[$field] ==
'accountancy_code_sell') { $valuetoshow = $langs->trans(
"AccountancyCodeSell"); $sortable = 0; }
1400 if ($fieldlist[$field] ==
'accountancy_code_buy') { $valuetoshow = $langs->trans(
"AccountancyCodeBuy"); $sortable = 0; }
1401 if ($fieldlist[$field] ==
'fk_pcg_version') { $valuetoshow = $langs->trans(
"Pcg_version"); }
1402 if ($fieldlist[$field] ==
'account_parent') { $valuetoshow = $langs->trans(
"Accountsparent"); }
1403 if ($fieldlist[$field] ==
'pcg_type') { $valuetoshow = $langs->trans(
"Pcg_type"); }
1404 if ($fieldlist[$field] ==
'pcg_subtype') { $valuetoshow = $langs->trans(
"Pcg_subtype"); }
1405 if ($fieldlist[$field] ==
'sortorder') { $valuetoshow = $langs->trans(
"SortOrder"); }
1406 if ($fieldlist[$field] ==
'short_label') { $valuetoshow = $langs->trans(
"ShortLabel"); }
1407 if ($fieldlist[$field] ==
'range_account') { $valuetoshow = $langs->trans(
"Range"); }
1408 if ($fieldlist[$field] ==
'sens') { $valuetoshow = $langs->trans(
"Sens"); }
1409 if ($fieldlist[$field] ==
'category_type') { $valuetoshow = $langs->trans(
"Calculated"); }
1410 if ($fieldlist[$field] ==
'formula') { $valuetoshow = $langs->trans(
"Formula"); }
1411 if ($fieldlist[$field] ==
'paper_size') { $valuetoshow = $langs->trans(
"PaperSize"); }
1412 if ($fieldlist[$field] ==
'orientation') { $valuetoshow = $langs->trans(
"Orientation"); }
1413 if ($fieldlist[$field] ==
'leftmargin') { $valuetoshow = $langs->trans(
"LeftMargin"); }
1414 if ($fieldlist[$field] ==
'topmargin') { $valuetoshow = $langs->trans(
"TopMargin"); }
1415 if ($fieldlist[$field] ==
'spacex') { $valuetoshow = $langs->trans(
"SpaceX"); }
1416 if ($fieldlist[$field] ==
'spacey') { $valuetoshow = $langs->trans(
"SpaceY"); }
1417 if ($fieldlist[$field] ==
'font_size') { $valuetoshow = $langs->trans(
"FontSize"); }
1418 if ($fieldlist[$field] ==
'custom_x') { $valuetoshow = $langs->trans(
"CustomX"); }
1419 if ($fieldlist[$field] ==
'custom_y') { $valuetoshow = $langs->trans(
"CustomY"); }
1420 if ($fieldlist[$field] ==
'percent') { $valuetoshow = $langs->trans(
"Percentage"); }
1421 if ($fieldlist[$field] ==
'affect') { $valuetoshow = $langs->trans(
"WithCounter"); }
1422 if ($fieldlist[$field] ==
'delay') { $valuetoshow = $langs->trans(
"NoticePeriod"); }
1423 if ($fieldlist[$field] ==
'newbymonth') { $valuetoshow = $langs->trans(
"NewByMonth"); }
1424 if ($fieldlist[$field] ==
'fk_tva') { $valuetoshow = $langs->trans(
"VAT"); }
1425 if ($fieldlist[$field] ==
'range_ik') { $valuetoshow = $langs->trans(
"RangeIk"); }
1426 if ($fieldlist[$field] ==
'fk_c_exp_tax_cat') { $valuetoshow = $langs->trans(
"CarCategory"); }
1427 if ($fieldlist[$field] ==
'revenuestamp_type') { $valuetoshow = $langs->trans(
'TypeOfRevenueStamp'); }
1428 if ($fieldlist[$field] ==
'use_default') { $valuetoshow = $langs->trans(
'Default'); $cssprefix =
'center '; }
1429 if ($fieldlist[$field] ==
'unit_type') { $valuetoshow = $langs->trans(
'TypeOfUnit'); }
1431 if ($fieldlist[$field] ==
'region_id' || $fieldlist[$field] ==
'country_id') { $showfield = 0; }
1436 if (!empty($tabhelp[$id][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[$id][$value])) $newvaluetoshow =
'<a href="'.$tabhelp[$id][$value].
'" target="_blank">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
1437 elseif (!empty($tabhelp[$id][$value])) $newvaluetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1438 else $newvaluetoshow = $valuetoshow;
1440 print getTitleFieldOfList($newvaluetoshow, 0,
$_SERVER[
"PHP_SELF"], ($sortable ? $fieldlist[$field] :
''), ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $cssprefix);
1444 if ($id == 4)
print getTitleFieldOfList($langs->trans(
"Favorite"), 0,
$_SERVER[
"PHP_SELF"],
"favorite", ($page ?
'page='.$page.
'&' :
''), $param,
'align="center"', $sortfield, $sortorder);
1446 print getTitleFieldOfList($langs->trans(
"Status"), 0,
$_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'align="center"', $sortfield, $sortorder);
1456 $obj = $db->fetch_object(
$resql);
1458 print '<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1459 if ($action ==
'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
1461 $tmpaction =
'edit';
1462 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1463 $reshook = $hookmanager->executeHooks(
'editDictionaryFieldlist', $parameters, $obj, $tmpaction);
1464 $error = $hookmanager->error; $errors = $hookmanager->errors;
1467 if (empty($reshook)) {
1468 $withentity =
fieldList($fieldlist, $obj, $tabname[$id],
'edit');
1471 print '<td colspan="3" class="center">';
1472 print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1473 print '<input type="hidden" name="page" value="'.dol_escape_htmltag($page).
'">';
1474 print '<input type="hidden" name="rowid" value="'.dol_escape_htmltag($rowid).
'">';
1475 if (!is_null($withentity))
1476 print '<input type="hidden" name="entity" value="'.$withentity.
'">';
1477 print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1478 print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1481 $tmpaction =
'view';
1482 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1483 $reshook = $hookmanager->executeHooks(
'viewDictionaryFieldlist', $parameters, $obj, $tmpaction);
1485 $error = $hookmanager->error; $errors = $hookmanager->errors;
1487 if (empty($reshook))
1491 foreach ($fieldlist as $field => $value)
1496 $valuetoshow = $obj->{$fieldlist[$field]};
1498 if ($fieldlist[$field] ==
'entity') {
1499 $withentity = $valuetoshow;
1503 if ($value ==
'element') {
1504 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1505 } elseif ($value ==
'source') {
1506 $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
1507 } elseif ($valuetoshow ==
'all') {
1508 $valuetoshow = $langs->trans(
'All');
1509 } elseif ($fieldlist[$field] ==
'country') {
1510 if (empty($obj->country_code))
1514 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
1515 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code) ? $obj->country_code.
" - ".$key : $obj->country);
1517 } elseif ($fieldlist[$field] ==
'recuperableonly' || $fieldlist[$field] ==
'deductible' || $fieldlist[$field] ==
'category_type') {
1518 $valuetoshow =
yn($valuetoshow);
1520 } elseif ($fieldlist[$field] ==
'type_cdr') {
1521 if (empty($valuetoshow)) $valuetoshow = $langs->trans(
'None');
1522 elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
1523 elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
1525 } elseif ($fieldlist[$field] == '
price' || preg_match('/^amount/i', $fieldlist[$field])) {
1526 $valuetoshow =
price($valuetoshow);
1528 if ($value ==
'private')
1530 $valuetoshow =
yn($elementList[$valuetoshow]);
1531 } elseif ($fieldlist[$field] ==
'libelle_facture') {
1532 $langs->load(
"bills");
1533 $key = $langs->trans(
"PaymentCondition".strtoupper($obj->code));
1534 $valuetoshow = ($obj->code && $key !=
"PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1535 $valuetoshow = nl2br($valuetoshow);
1536 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_country') {
1537 $key = $langs->trans(
"Country".strtoupper($obj->code));
1538 $valuetoshow = ($obj->code && $key !=
"Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1539 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_availability') {
1540 $langs->load(
"propal");
1541 $key = $langs->trans(
"AvailabilityType".strtoupper($obj->code));
1542 $valuetoshow = ($obj->code && $key !=
"AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1543 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_actioncomm') {
1544 $key = $langs->trans(
"Action".strtoupper($obj->code));
1545 $valuetoshow = ($obj->code && $key !=
"Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1546 } elseif (!empty($obj->code_iso) && $fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_currencies') {
1547 $key = $langs->trans(
"Currency".strtoupper($obj->code_iso));
1548 $valuetoshow = ($obj->code_iso && $key !=
"Currency".strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]});
1549 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_typent') {
1550 $key = $langs->trans(strtoupper($obj->code));
1551 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1552 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_prospectlevel') {
1553 $key = $langs->trans(strtoupper($obj->code));
1554 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1555 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_civility') {
1556 $key = $langs->trans(
"Civility".strtoupper($obj->code));
1557 $valuetoshow = ($obj->code && $key !=
"Civility".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1558 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_type_contact') {
1559 $langs->load(
'agenda');
1560 $key = $langs->trans(
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code));
1561 $valuetoshow = ($obj->code && $key !=
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1562 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_payment_term') {
1563 $langs->load(
"bills");
1564 $key = $langs->trans(
"PaymentConditionShort".strtoupper($obj->code));
1565 $valuetoshow = ($obj->code && $key !=
"PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1566 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_paiement') {
1567 $langs->load(
"bills");
1568 $key = $langs->trans(
"PaymentType".strtoupper($obj->code));
1569 $valuetoshow = ($obj->code && $key !=
"PaymentType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1570 } elseif ($fieldlist[$field] ==
'type' && $tabname[$id] == MAIN_DB_PREFIX.
'c_paiement') {
1571 $payment_type_list = array(0=>$langs->trans(
'PaymentTypeCustomer'), 1=>$langs->trans(
'PaymentTypeSupplier'), 2=>$langs->trans(
'PaymentTypeBoth'));
1572 $valuetoshow = $payment_type_list[$valuetoshow];
1573 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_input_reason') {
1574 $key = $langs->trans(
"DemandReasonType".strtoupper($obj->code));
1575 $valuetoshow = ($obj->code && $key !=
"DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1576 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_input_method') {
1577 $langs->load(
"orders");
1578 $key = $langs->trans($obj->code);
1579 $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$fieldlist[$field]};
1580 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_shipment_mode') {
1581 $langs->load(
"sendings");
1582 $key = $langs->trans(
"SendingMethod".strtoupper($obj->code));
1583 $valuetoshow = ($obj->code && $key !=
"SendingMethod".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1584 } elseif ($fieldlist[$field] ==
'libelle' && $tabname[$id] == MAIN_DB_PREFIX.
'c_paper_format')
1586 $key = $langs->trans(
'PaperFormat'.strtoupper($obj->code));
1587 $valuetoshow = ($obj->code && $key !=
'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1588 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_type_fees')
1590 $langs->load(
'trips');
1591 $key = $langs->trans(strtoupper($obj->code));
1592 $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1593 } elseif ($fieldlist[$field] ==
'region_id' || $fieldlist[$field] ==
'country_id') {
1595 } elseif ($fieldlist[$field] ==
'unicode') {
1596 $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
1597 } elseif ($fieldlist[$field] ==
'label' && $tabname[$_GET[
"id"]] == MAIN_DB_PREFIX.
'c_units') {
1598 $langs->load(
"products");
1599 $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
1600 } elseif ($fieldlist[$field] ==
'short_label' && $tabname[$_GET[
"id"]] == MAIN_DB_PREFIX.
'c_units') {
1601 $langs->load(
"products");
1602 $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
1603 } elseif (($fieldlist[$field] ==
'unit') && ($tabname[$id] == MAIN_DB_PREFIX.
'c_paper_format'))
1605 $key = $langs->trans(
'SizeUnit'.strtolower($obj->unit));
1606 $valuetoshow = ($obj->code && $key !=
'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]});
1607 } elseif ($fieldlist[$field] ==
'localtax1' || $fieldlist[$field] ==
'localtax2') {
1609 } elseif ($fieldlist[$field] ==
'localtax1_type') {
1610 if ($obj->localtax1 != 0)
1611 $valuetoshow = $localtax_typeList[$valuetoshow];
1612 else $valuetoshow =
'';
1614 } elseif ($fieldlist[$field] ==
'localtax2_type') {
1615 if ($obj->localtax2 != 0)
1616 $valuetoshow = $localtax_typeList[$valuetoshow];
1617 else $valuetoshow =
'';
1619 } elseif ($fieldlist[$field] ==
'taux') {
1620 $valuetoshow =
price($valuetoshow, 0, $langs, 0, 0);
1622 } elseif (in_array($fieldlist[$field], array(
'recuperableonly'))) {
1624 } elseif ($fieldlist[$field] ==
'accountancy_code' || $fieldlist[$field] ==
'accountancy_code_sell' || $fieldlist[$field] ==
'accountancy_code_buy') {
1626 } elseif ($fieldlist[$field] ==
'fk_tva')
1628 foreach ($form->cache_vatrates as $key => $Tab)
1630 if ($form->cache_vatrates[$key][
'rowid'] == $valuetoshow)
1632 $valuetoshow = $form->cache_vatrates[$key][
'libtva'];
1636 } elseif ($fieldlist[$field] ==
'fk_c_exp_tax_cat')
1638 $valuetoshow =
getDictvalue(MAIN_DB_PREFIX.
'c_exp_tax_cat',
'label', $valuetoshow);
1639 $valuetoshow = $langs->trans($valuetoshow);
1640 } elseif ($tabname[$id] == MAIN_DB_PREFIX.
'c_exp_tax_cat')
1642 $valuetoshow = $langs->trans($valuetoshow);
1643 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_units')
1645 $langs->load(
'other');
1646 $key = $langs->trans($obj->label);
1647 $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
1648 } elseif ($fieldlist[$field] ==
'code' && $id == 3) {
1649 $valuetoshow = $obj->state_code;
1650 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] == MAIN_DB_PREFIX.
'c_product_nature') {
1651 $langs->load(
"products");
1652 $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
1654 $class .= ($class ?
' ' :
'').
'tddict';
1655 if ($fieldlist[$field] ==
'note' && $id == 10) $class .=
' tdoverflowmax200';
1656 if ($fieldlist[$field] ==
'tracking') $class .=
' tdoverflowauto';
1657 if ($fieldlist[$field] ==
'position') $class .=
' right';
1658 if ($fieldlist[$field] ==
'localtax1_type') $class .=
' nowrap';
1659 if ($fieldlist[$field] ==
'localtax2_type') $class .=
' nowrap';
1660 if ($fieldlist[$field] ==
'pos') $class .=
' right';
1661 if ($fieldlist[$field] ==
'use_default') $class .=
' center';
1663 if ($showfield)
print '<!-- '.$fieldlist[$field].
' --><td class="'.$class.
'">'.$valuetoshow.
'</td>';
1672 if (isset($obj->code) && $id != 10 && $id != 42)
1674 if (($obj->code ==
'0' || $obj->code ==
'' || preg_match(
'/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; } elseif ($obj->code ==
'RECEP') { $iserasable = 0; $canbedisabled = 0; } elseif ($obj->code ==
'EF0') { $iserasable = 0; $canbedisabled = 0; }
1676 if ($id == 25 && in_array($obj->code, array(
'banner',
'blogpost',
'other',
'page')))
1678 $iserasable = 0; $canbedisabled = 0;
1679 if (in_array($obj->code, array(
'banner'))) $canbedisabled = 1;
1681 if (isset($obj->type) && in_array($obj->type, array(
'system',
'systemauto'))) { $iserasable = 0; }
1682 if (in_array($obj->code, array(
'AC_OTH',
'AC_OTH_AUTO')) || in_array($obj->type, array(
'systemauto'))) { $canbedisabled = 0; $canbedisabled = 0; }
1683 $canbemodified = $iserasable;
1685 if ($obj->code ==
'RECEP') $canbemodified = 1;
1686 if ($tabname[$id] == MAIN_DB_PREFIX.
"c_actioncomm") $canbemodified = 1;
1689 $rowidcol = $tabrowid[$id];
1691 if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) $rowidcol =
'rowid';
1692 $url =
$_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} ==
'0') ? $obj->{$rowidcol}:(!empty($obj->code) ?urlencode($obj->code) :
'')).
'&code='.(!empty($obj->code) ?urlencode($obj->code) :
'');
1693 if (!empty($param)) $url .=
'&'.$param;
1694 if (!is_null($withentity)) $url .=
'&entity='.$withentity;
1701 print '<td class="nowrap center">';
1702 if ($iserasable)
print '<a class="reposition" href="'.$url.
'action='.$acts[$obj->favorite].
'_favorite">'.$actl[$obj->favorite].
'</a>';
1703 else print $langs->trans(
"AlwaysActive");
1708 print '<td class="nowrap center">';
1709 if ($canbedisabled)
print '<a class="reposition" href="'.$url.
'action='.$acts[$obj->active].
'">'.$actl[$obj->active].
'</a>';
1711 if (in_array($obj->code, array(
'AC_OTH',
'AC_OTH_AUTO')))
print $langs->trans(
"AlwaysActive");
1712 elseif (isset($obj->type) && in_array($obj->type, array(
'systemauto')) && empty($obj->active))
print $langs->trans("Deprecated");
1713 elseif (isset($obj->
type) && in_array($obj->
type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH')
print $langs->trans("UsedOnlyWithTypeOption");
1714 else print $langs->trans("AlwaysActive");
1719 if ($canbemodified)
print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.
newToken().'">'.
img_edit().'</a></td>';
1725 print '<td class="center">';
1729 }
else print '<td> </td>';
1749 $lastlineisempty =
false;
1751 print '<div class="div-table-responsive-no-min">';
1752 print '<table class="noborder centpercent">';
1753 print '<tr class="liste_titre">';
1754 print '<td colspan="2">'.$langs->trans(
"Dictionary").
'</td>';
1755 print '<td>'.$langs->trans(
"Table").
'</td>';
1758 $showemptyline =
'';
1759 foreach ($taborder as $i)
1761 if (isset($tabname[$i]) && empty($tabcond[$i]))
continue;
1767 print '<tr class="oddeven"><td width="50%"> </td><td> </td><td> </td></tr>';
1772 $value = $tabname[$i];
1773 print '<tr class="oddeven"><td width="50%">';
1774 if (!empty($tabcond[$i]))
1776 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i.
'">'.$langs->trans($tablib[$i]).
'</a>';
1778 print $langs->trans($tablib[$i]);
1787 print '<td>'.$tabname[$i].
'</td></tr>';
1788 $lastlineisempty =
false;
1790 if (!$lastlineisempty)
1793 $lastlineisempty =
true;
1817 function fieldList($fieldlist, $obj =
'', $tabname =
'', $context =
'')
1819 global $conf, $langs, $db, $mysoc;
1822 global $elementList, $sourceList, $localtax_typeList;
1830 foreach ($fieldlist as $field => $value)
1832 if ($fieldlist[$field] ==
'entity') {
1833 $withentity = $obj->{$fieldlist[$field]};
1837 if (in_array($fieldlist[$field], array(
'code',
'libelle',
'type')) && $tabname == MAIN_DB_PREFIX.
"c_actioncomm" && in_array($obj->type, array(
'system',
'systemauto')))
1839 $hidden = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
'');
1841 print '<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$hidden.
'">';
1842 print $langs->trans($hidden);
1844 } elseif ($fieldlist[$field] ==
'country')
1846 if (in_array(
'region_id', $fieldlist))
1853 $fieldname =
'country';
1854 print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country :
'')), $fieldname,
'', 28,
'maxwidth150 maxwidthonsmartphone');
1856 } elseif ($fieldlist[$field] ==
'country_id')
1858 if (!in_array(
'country', $fieldlist))
1860 $country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
1861 print '<td class="tdoverflowmax100">';
1862 print '<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$country_id.
'">';
1865 } elseif ($fieldlist[$field] ==
'region')
1868 $formcompany->select_region($region_id,
'region');
1870 } elseif ($fieldlist[$field] ==
'region_id')
1872 $region_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:0);
1874 print '<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$region_id.
'">';
1876 } elseif ($fieldlist[$field] ==
'lang')
1879 print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,
'lang');
1883 elseif ($fieldlist[$field] ==
'element')
1886 print $form->selectarray(
'element', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''));
1890 elseif ($fieldlist[$field] ==
'source')
1893 print $form->selectarray(
'source', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''));
1895 } elseif ($fieldlist[$field] ==
'private')
1898 print $form->selectyesno(
"private", (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''));
1900 } elseif ($fieldlist[$field] ==
'type' && $tabname == MAIN_DB_PREFIX.
"c_actioncomm")
1902 $type = (!empty($obj->type) ? $obj->type :
'user');
1904 print $type.
'<input type="hidden" name="type" value="'.$type.
'">';
1906 } elseif ($fieldlist[$field] ==
'type' && $tabname == MAIN_DB_PREFIX.
'c_paiement')
1909 $select_list = array(0=>$langs->trans(
'PaymentTypeCustomer'), 1=>$langs->trans(
'PaymentTypeSupplier'), 2=>$langs->trans(
'PaymentTypeBoth'));
1910 print $form->selectarray($fieldlist[$field], $select_list, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
'2'));
1912 } elseif ($fieldlist[$field] ==
'recuperableonly' || $fieldlist[$field] ==
'type_cdr' || $fieldlist[$field] ==
'deductible' || $fieldlist[$field] ==
'category_type') {
1913 if ($fieldlist[$field] ==
'type_cdr')
print '<td class="center">';
1915 if ($fieldlist[$field] ==
'type_cdr') {
1916 print $form->selectarray($fieldlist[$field], array(0=>$langs->trans(
'None'), 1=>$langs->trans(
'AtEndOfMonth'), 2=>$langs->trans(
'CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''));
1918 print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''), 1);
1921 } elseif (in_array($fieldlist[$field], array(
'nbjour',
'decalage',
'taux',
'localtax1',
'localtax2'))) {
1923 if (in_array($fieldlist[$field], array(
'taux',
'localtax1',
'localtax2'))) $class =
"center";
1924 print '<td class="'.$class.
'">';
1925 print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} :
'').
'" size="3" name="'.$fieldlist[$field].
'">';
1927 } elseif (in_array($fieldlist[$field], array(
'libelle_facture'))) {
1932 if ($tabname == MAIN_DB_PREFIX.
'c_payment_term')
1934 $langs->load(
"bills");
1935 $transkey =
"PaymentCondition".strtoupper($obj->code);
1936 if ($langs->trans($transkey) != $transkey)
1939 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
1944 print '<textarea cols="30" rows="'.ROWS_2.
'" class="flat" name="'.$fieldlist[$field].
'">'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
'').
'</textarea>';
1946 print '<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$transkey.
'">';
1949 } elseif ($fieldlist[$field] ==
'price' || preg_match(
'/^amount/i', $fieldlist[$field])) {
1950 print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
'')).
'" name="'.$fieldlist[$field].
'"></td>';
1951 } elseif ($fieldlist[$field] ==
'code' && isset($obj->{$fieldlist[$field]})) {
1952 print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
'').
'" name="'.$fieldlist[$field].
'"></td>';
1953 } elseif ($fieldlist[$field] ==
'unit') {
1956 'mm' => $langs->trans(
'SizeUnitmm'),
1957 'cm' => $langs->trans(
'SizeUnitcm'),
1958 'point' => $langs->trans(
'SizeUnitpoint'),
1959 'inch' => $langs->trans(
'SizeUnitinch')
1961 print $form->selectarray(
'unit', $units, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''), 0, 0, 0);
1965 elseif ($fieldlist[$field] ==
'localtax1_type' || $fieldlist[$field] ==
'localtax2_type')
1967 print '<td class="center">';
1968 print $form->selectarray($fieldlist[$field], $localtax_typeList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
''));
1970 } elseif ($fieldlist[$field] ==
'accountancy_code' || $fieldlist[$field] ==
'accountancy_code_sell' || $fieldlist[$field] ==
'accountancy_code_buy')
1973 if (!empty($conf->accounting->enabled))
1975 $fieldname = $fieldlist[$field];
1976 $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0);
1977 print $formaccounting->select_account($accountancy_account,
'.'.$fieldlist[$field], 1,
'', 1, 1,
'maxwidth200 maxwidthonsmartphone');
1979 $fieldname = $fieldlist[$field];
1980 print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname :
'').
'" name="'.$fieldlist[$field].
'">';
1983 } elseif ($fieldlist[$field] ==
'fk_tva')
1986 print $form->load_tva(
'fk_tva', $obj->taux, $mysoc,
new Societe($db), 0, 0,
'',
false, -1);
1988 } elseif ($fieldlist[$field] ==
'fk_c_exp_tax_cat')
1991 print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
1993 } elseif ($fieldlist[$field] ==
'fk_range')
1996 print $form->selectExpenseRanges($obj->fk_range);
1999 $fieldValue = isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:
'';
2001 if ($fieldlist[$field] ==
'sortorder')
2003 $fieldlist[$field] =
'position';
2006 $classtd =
''; $class =
'';
2007 if ($fieldlist[$field] ==
'code') $class =
'maxwidth100';
2008 if (in_array($fieldlist[$field], array(
'dayrule',
'day',
'month',
'year',
'pos',
'use_default',
'affect',
'delay',
'position',
'sortorder',
'sens',
'category_type'))) {
2009 $class =
'maxwidth50 center';
2011 if (in_array($fieldlist[$field], array(
'use_default'))) {
2012 $classtd =
'center';
2014 if (in_array($fieldlist[$field], array(
'libelle',
'label',
'tracking'))) $class =
'quatrevingtpercent';
2015 print '<td class="'.$classtd.
'">';
2018 if (in_array($fieldlist[$field], array(
'label',
'libelle')))
2021 if ($tabname == MAIN_DB_PREFIX.
'c_civility') {
2022 $transkey =
"Civility".strtoupper($obj->code);
2024 if ($tabname == MAIN_DB_PREFIX.
'c_payment_term') {
2025 $langs->load(
"bills");
2026 $transkey =
"PaymentConditionShort".strtoupper($obj->code);
2028 if ($transkey && $langs->trans($transkey) != $transkey)
2031 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
2036 print '<input type="text" class="flat'.($class ?
' '.$class :
'').
'" value="'.
dol_escape_htmltag($fieldValue).
'" name="'.$fieldlist[$field].
'">';
2038 print '<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$transkey.
'">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDictvalue($tablename, $field, $id, $checkentity=false, $rowidfield= 'rowid')
Return value from dictionary.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
complete_elementList_with_modules(&$elementList)
Search external modules to complete the list of contact element.
if(!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'] country if(!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'] typent code
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabfieldcheck)
Add external modules to list of dictionaries.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
print_fleche_navigation($page, $file, $options= '', $nextpage=0, $betweenarrows= '', $afterarrows= '', $limit=-1, $totalnboflines=0, $hideselectlimit=0, $beforearrows= '')
Function to show navigation arrows into lists.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
fieldList($fieldlist, $obj= '', $tabname= '', $context= '')
Show fields in insert/edit mode.
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous) ...
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...