diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c22e83f786..09cac93b0b2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -316,6 +316,32 @@ class Form return $ret; } + /** + * Output edit in place form + * + * @param string $fieldname Name of the field + * @param object $object Object + * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @return string HTML code for the edit of alternative language + */ + public function widgetForTranslation($htmlname, $object, $perm, $typeofdata = 'string') { + global $conf, $langs; + + $result = ''; + + if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) { + $result ='
| '; + print ' | |||||
| '; if ($object->particulier || $private) { print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; @@ -1196,7 +1203,9 @@ else print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print ' | global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; - print ' | '; + print ''; + print $form->widgetForTranslation("name", $object, $permissiontoadd); + print ''; if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').' | '; @@ -1249,7 +1258,7 @@ else { // Supplier print ' | ||
| '.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).' | '; + print ' | '.$form->editfieldkey('Vendor', 'fournisseur', '', $object, $permissiontoadd, 'string', '', 1).' | '; $default = -1; if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default = 1; print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ?GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0)); @@ -1261,7 +1270,7 @@ else print ' | '; if (!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire)) { - print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, $permissiontoadd); } print ' | '; if (!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire)) @@ -1279,35 +1288,40 @@ else } // Status - print ' |
| '.$form->editfieldkey('Status', 'status', '', $object, 0).' | '; + print ' | ||||
| '.$form->editfieldkey('Status', 'status', '', $object, $permissiontoadd).' | '; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1); print ' | ||||
| '.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).' | '; + print '|||||
| '.$form->editfieldkey('Gencod', 'barcode', '', $object, $permissiontoadd).' | '; print ''; print ' | ||||
| '.$form->editfieldkey('Address', 'address', '', $object, 0).' | '; + print '|||||
| '; + print $form->editfieldkey('Address', 'address', '', $object, $permissiontoadd); + print ' | '; print '|||||
| '.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).' | '; + print ' | ||||
| '.$form->editfieldkey('Zip', 'zipcode', '', $object, $permissiontoadd).' | '; print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); print ' | '; if ($conf->browser->layout == 'phone') print '||||
| '.$form->editfieldkey('Town', 'town', '', $object, 0).' | '; + print ' | '.$form->editfieldkey('Town', 'town', '', $object, $permissiontoadd).' | '; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); + print $form->widgetForTranslation("town", $object, $permissiontoadd); print ' | ||
| '.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).' | '; + print ' | ||||
| '.$form->editfieldkey('Country', 'selectcountry_id', '', $object, $permissiontoadd).' | '; print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ' | ||||