31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
46$langs->loadLangs(array(
'products',
'languages'));
50$action =
GETPOST(
'action',
'aZ09');
51$cancel =
GETPOST(
'cancel',
'alpha');
54$fieldvalue = (!empty($id) ?
$id : (!empty($ref) ? $ref :
''));
55$fieldtype = (!empty($ref) ?
'ref' :
'rowid');
57 $socid = $user->socid;
60if ($id > 0 || !empty($ref)) {
66$hookmanager->initHooks(array(
'producttranslationcard',
'globalcard'));
69 if (
$object->type == $object::TYPE_PRODUCT) {
72 if (
$object->type == $object::TYPE_SERVICE) {
76 restrictedArea($user,
'produit|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
87$parameters = array(
'id'=>$id,
'ref'=>$ref);
88$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
94 if ($cancel == $langs->trans(
"Cancel")) {
98 if ($action ==
'delete' &&
GETPOST(
'langtodelete',
'alpha') && $usercancreate) {
107 if ($action ==
'vadd' && $cancel != $langs->trans(
"Cancel") && $usercancreate) {
110 $current_lang = $langs->getDefaultLang();
113 if (
GETPOST(
"forcelangprod") == $current_lang) {
126 if (
GETPOST(
"forcelangprod")) {
127 $result =
$object->setMultiLangs($user);
129 $object->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language"));
142 if ($action ==
'vedit' && $cancel != $langs->trans(
"Cancel") && $usercancreate) {
145 $current_lang = $langs->getDefaultLang();
147 foreach (
$object->multilangs as $key => $value) {
148 if ($key == $current_lang) {
161 $result =
$object->setMultiLangs($user);
171 if ($action ==
'vdelete' && $cancel != $langs->trans(
"Cancel") && $usercancreate) {
174 $langtodelete =
GETPOST(
'langdel',
'alpha');
176 $result =
$object->delMultiLangs($langtodelete, $user);
187$result =
$object->fetch($id, $ref);
194$title = $langs->trans(
'ProductServiceCard');
198 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'Translation');
199 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
202 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'Translation');
203 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
206llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-translation');
208$form =
new Form($db);
212$titre = $langs->trans(
"CardProduct".
$object->type);
218if (!empty(
$object->multilangs)) {
219 foreach (
$object->multilangs as $key => $value) {
227$linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1&type='.
$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
230if ($user->socid && !in_array(
'product', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
234dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'',
'',
'', 0,
'',
'', 1);
243print
"\n".
'<div class="tabsAction">'.
"\n";
245$parameters = array();
246$reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
247if (empty($reshook)) {
249 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
250 print
'<a class="butAction" href="' . DOL_URL_ROOT .
'/product/traduction.php?action=add&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"Add") .
'</a>';
251 if ($cnt_trans > 0) {
252 print
'<a class="butAction" href="' . DOL_URL_ROOT .
'/product/traduction.php?action=edit&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"Modify") .
'</a>';
258print
"\n".
'</div>'.
"\n";
262if ($action ==
'edit') {
264 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
266 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
267 print
'<input type="hidden" name="token" value="'.newToken().
'">';
268 print
'<input type="hidden" name="action" value="vedit">';
269 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
271 if (!empty(
$object->multilangs)) {
273 foreach (
$object->multilangs as $key => $value) {
277 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>';
279 print
'<div class="underbanner clearboth"></div>';
280 print
'<table class="border centpercent">';
281 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>';
282 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>';
283 $doleditor =
new DolEditor(
"desc-$key",
$object->multilangs[$key][
"description"],
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
284 $doleditor->Create();
287 print
'<tr><td class="tdtop">'.$langs->trans(
"NotePrivate").
'</td><td>';
288 $doleditor =
new DolEditor(
"other-$key",
$object->multilangs[$key][
"other"],
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
289 $doleditor->Create();
296 $parameters = array();
297 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
301 print $form->buttonsSaveCancel();
304} elseif ($action !=
'add') {
305 if (!empty(
$object->multilangs)) {
307 foreach (
$object->multilangs as $key => $value) {
311 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>';
313 print
'<div class="fichecenter">';
314 print
'<div class="underbanner clearboth"></div>';
315 print
'<table class="border centpercent">';
316 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
'Label').
'</td><td>'.
$object->multilangs[$key][
"label"].
'</td></tr>';
317 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>'.
$object->multilangs[$key][
"description"].
'</td></tr>';
319 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td><td>'.
$object->multilangs[$key][
"other"].
'</td></tr>';
325 if (!$cnt_trans && $action !=
'add') {
326 print
'<div class="opacitymedium">'.$langs->trans(
'NoTranslation').
'</div>';
336if ($action ==
'add' && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
338 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
341 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
342 print
'<input type="hidden" name="token" value="'.newToken().
'">';
343 print
'<input type="hidden" name="action" value="vadd">';
344 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">';
348 print
'<table class="border centpercent">';
349 print
'<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans(
'Language').
'</td><td>';
350 print $formadmin->select_language(
GETPOST(
'forcelangprod'),
'forcelangprod', 0,
$object->multilangs, 1);
352 print
'<tr><td class="tdtop fieldrequired">'.$langs->trans(
'Label').
'</td><td><input name="libelle" size="40"></td></tr>';
353 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>';
354 $doleditor =
new DolEditor(
'desc',
'',
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
355 $doleditor->Create();
359 print
'<tr><td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td><td>';
360 $doleditor =
new DolEditor(
'other',
'',
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_DETAILS'), ROWS_3,
'90%');
361 $doleditor->Create();
366 $parameters = array();
367 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
371 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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 a 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.