30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
37$langs->loadLangs(array(
'products',
'languages'));
41$action =
GETPOST(
'action',
'aZ09');
42$cancel =
GETPOST(
'cancel',
'alpha');
45$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref :
''));
46$fieldtype = (!empty($ref) ?
'ref' :
'rowid');
48 $socid = $user->socid;
51if ($id > 0 || !empty($ref)) {
57 if (
$object->type == $object::TYPE_PRODUCT) {
60 if (
$object->type == $object::TYPE_SERVICE) {
64 restrictedArea($user,
'produit|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
68$hookmanager->initHooks(array(
'producttranslationcard',
'globalcard'));
78$parameters = array(
'id'=>$id,
'ref'=>$ref);
79$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
85 if ($cancel == $langs->trans(
"Cancel")) {
89 if ($action ==
'delete' &&
GETPOST(
'langtodelete',
'alpha') && $usercancreate) {
98 if ($action ==
'vadd' && $cancel != $langs->trans(
"Cancel") && $usercancreate) {
101 $current_lang = $langs->getDefaultLang();
104 if (
GETPOST(
"forcelangprod") == $current_lang) {
117 if (
GETPOST(
"forcelangprod")) {
118 $result =
$object->setMultiLangs($user);
120 $object->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language"));
133 if ($action ==
'vedit' && $cancel != $langs->trans(
"Cancel") && $usercancreate) {
136 $current_lang = $langs->getDefaultLang();
138 foreach (
$object->multilangs as $key => $value) {
139 if ($key == $current_lang) {
152 $result =
$object->setMultiLangs($user);
162 if ($action ==
'vdelete' && $cancel != $langs->trans(
"Cancel") && $usercancreate) {
165 $langtodelete =
GETPOST(
'langdel',
'alpha');
167 $result =
$object->delMultiLangs($langtodelete, $user);
178$result =
$object->fetch($id, $ref);
185$title = $langs->trans(
'ProductServiceCard');
189 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'Translation');
190 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
193 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'Translation');
194 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
197llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-translation');
199$form =
new Form($db);
203$titre = $langs->trans(
"CardProduct".
$object->type);
209if (!empty(
$object->multilangs)) {
210 foreach (
$object->multilangs as $key => $value) {
218$linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1&type='.
$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
221if ($user->socid && !in_array(
'product', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
225dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'',
'',
'', 0,
'',
'', 1);
234print
"\n".
'<div class="tabsAction">'.
"\n";
236$parameters = array();
237$reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
238if (empty($reshook)) {
240 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
241 print
'<a class="butAction" href="' . DOL_URL_ROOT .
'/product/traduction.php?action=add&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"Add") .
'</a>';
242 if ($cnt_trans > 0) {
243 print
'<a class="butAction" href="' . DOL_URL_ROOT .
'/product/traduction.php?action=edit&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"Modify") .
'</a>';
249print
"\n".
'</div>'.
"\n";
253if ($action ==
'edit') {
255 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
257 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
258 print
'<input type="hidden" name="token" value="'.newToken().
'">';
259 print
'<input type="hidden" name="action" value="vedit">';
260 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
262 if (!empty(
$object->multilangs)) {
264 foreach (
$object->multilangs as $key => $value) {
268 print($i > 1 ?
"<br>" :
"").($s ? $s.
' ' :
'').
' <div class="inline-block margintop marginbottomonly"><b>'.$langs->trans(
'Language_'.$key).
'</b></div><div class="inline-block floatright"><a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'&langtodelete='.$key.
'">'.
img_delete(
'',
'class="valigntextbottom marginrightonly"').
'</a></div>';
270 print
'<div class="underbanner clearboth"></div>';
271 print
'<table class="border centpercent">';
272 print
'<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans(
'Label').
'</td><td><input name="libelle-'.$key.
'" size="40" value="'.
dol_escape_htmltag(
$object->multilangs[$key][
"label"]).
'"></td></tr>';
273 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>';
274 $doleditor =
new DolEditor(
"desc-$key",
$object->multilangs[$key][
"description"],
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
275 $doleditor->Create();
278 print
'<tr><td class="tdtop">'.$langs->trans(
"NotePrivate").
'</td><td>';
279 $doleditor =
new DolEditor(
"other-$key",
$object->multilangs[$key][
"other"],
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
280 $doleditor->Create();
287 $parameters = array();
288 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
292 print $form->buttonsSaveCancel();
295} elseif ($action !=
'add') {
296 if (!empty(
$object->multilangs)) {
298 foreach (
$object->multilangs as $key => $value) {
302 print($i > 1 ?
"<br>" :
"").($s ? $s.
' ' :
'').
' <div class="inline-block marginbottomonly"><b>'.$langs->trans(
'Language_'.$key).
'</b></div><div class="inline-block floatright"><a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'&langtodelete='.$key.
'">'.
img_delete(
'',
'class="valigntextbottom marginrightonly"').
'</a></div>';
304 print
'<div class="fichecenter">';
305 print
'<div class="underbanner clearboth"></div>';
306 print
'<table class="border centpercent">';
307 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
'Label').
'</td><td>'.
$object->multilangs[$key][
"label"].
'</td></tr>';
308 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>'.
$object->multilangs[$key][
"description"].
'</td></tr>';
310 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td><td>'.
$object->multilangs[$key][
"other"].
'</td></tr>';
316 if (!$cnt_trans && $action !=
'add') {
317 print
'<div class="opacitymedium">'.$langs->trans(
'NoTranslation').
'</div>';
327if ($action ==
'add' && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
329 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
332 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
333 print
'<input type="hidden" name="token" value="'.newToken().
'">';
334 print
'<input type="hidden" name="action" value="vadd">';
335 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">';
339 print
'<table class="border centpercent">';
340 print
'<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans(
'Language').
'</td><td>';
341 print $formadmin->select_language(
GETPOST(
'forcelangprod'),
'forcelangprod', 0,
$object->multilangs, 1);
343 print
'<tr><td class="tdtop fieldrequired">'.$langs->trans(
'Label').
'</td><td><input name="libelle" size="40"></td></tr>';
344 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>';
345 $doleditor =
new DolEditor(
'desc',
'',
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
346 $doleditor->Create();
350 print
'<tr><td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td><td>';
351 $doleditor =
new DolEditor(
'other',
'',
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
352 $doleditor->Create();
357 $parameters = array();
358 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
362 print $form->buttonsSaveCancel();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
product_prepare_head($object)
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.