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 $answer[
'content']=
$cn->get_value(
"select ad_text from attr_def where ad_id=$1",
75 catch (Exception $exc)
77 echo $exc->getMessage();
78 error_log($exc->getTraceAsString());
79 $answer[
'message']=$exc->getMessage();
84 case "remove_attribute":
87 if (
$cn->get_value(
"select count(*) from jnt_fic_attr
88 join fiche_def using (fd_id)
89 where frd_id=$1 and ad_id=$2",
91 throw new Exception(_(
"Attribut déjà utilisé"));
94 throw new Exception(_(
"Attribut obligatoire"));
96 $answer[
'content']=
$cn->get_value(
"select ad_text from attr_def where ad_id=$1",
100 $cn->exec_sql(
"delete from attr_min where frd_id=$1 and ad_id=$2",
103 catch (Exception $exc)
105 echo $exc->getMessage();
106 error_log($exc->getTraceAsString());
107 $answer[
'message']=$exc->getMessage();
116header(
"Content-type: text/json; charset: utf8",
true);
118 JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
global $g_user
if no group available , then stop
static id()
return the 'gDossier' value after a check
static trash($p_id, $p_javascript)
Display the icon of a trashbin.