22if (!defined(
'ALLOWED'))
23 die(
'Appel direct ne sont pas permis');
41 if (
$g_user->check_module(
"CMCARD")==0)
42 throw new Exception(
_(
"Accès non autorisé"));
51 $answer[
'message']=
_(
"Accès non autorisé");
52 header(
"Content-type: text/json; charset: utf8",
true);
54 JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
62 if (
$cn->get_value(
"select count(*) from attr_min where frd_id=$1 and ad_id=$2",
64 throw new Exception(
_(
"Attribut déjà ajouté"));
65 $cn->exec_sql(
"insert into attr_min (frd_id,ad_id) values ($1,$2)",
69 $js=sprintf(
"category_card.remove_attribut('%s','%s','%s',%d)",
71 $label=
$cn->get_value(
"select ad_text from attr_def where ad_id=$1",
73 $content=sprintf(
'<li id="%s_elt%d" style="cursor:move;border:1px solid navy;padding : 0.5rem 0.2rem 0.5rem 0.2rem;margin-top:2px">%s',
$objname
79 catch (Exception $exc)
81 echo $exc->getMessage();
82 error_log($exc->getTraceAsString());
83 $answer[
'message']=$exc->getMessage();
88 case "remove_attribute":
91 if (
$cn->get_value(
"select count(*) from jnt_fic_attr
92 join fiche_def using (fd_id)
93 where frd_id=$1 and ad_id=$2",
95 throw new Exception(
_(
"Attribut déjà utilisé"));
98 throw new Exception(
_(
"Attribut obligatoire"));
100 $answer[
'content']=
$cn->get_value(
"select ad_text from attr_def where ad_id=$1",
104 $cn->exec_sql(
"delete from attr_min where frd_id=$1 and ad_id=$2",
107 catch (Exception $exc)
109 echo $exc->getMessage();
110 error_log($exc->getTraceAsString());
111 $answer[
'message']=$exc->getMessage();
120header(
"Content-type: text/json; charset: utf8",
true);
122 JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
global $g_user
if no group available , then stop
_("actif, passif,charge,...")
static trash($p_id, $p_javascript)
Display the icon of a trashbin.