Either it assigned fields.tags as true or doesn't change, or doesn't save. similar attempts will change the variable on the page, but not save in the database.
vue section
<div class="form-group">
<div class="control-label" :class="Defines.cssform.label">Tags:<br><small class="text-muted">(select all that apply)</small></div>
<div v-for="item in category('CONTACT_memo_subcategories')" :key="item" >
<input type="checkbox" :value="item.id" v-model="fields.tags"><label></label>
</div>
</div>
php api section
public static function getClientMemo ($api, $args) {
$data = $api->getArgs();
$client_id=$args;
$staff_id=$api->authentication->getUser()->id;
if (is_array($staff_id)) $staff_id=$staff_id['id'];
$programs = '('.implode(',',ProgramStaff::getPivots('id_staff', $staff_id)).')';
$programs = ($programs=='()') ? '' : ' (ids_program IN '.$programs.') OR ';
$entries = self::getEntries(['as_array' => true, 'limit' => null, 'only_entries' => true, 'where' => [" ( id_client = ".$client_id." AND deleted = 0 AND ( ( (ids_program is null OR ids_program='') AND (ids_staff is null OR ids_staff='' OR ids_staff='[]' OR ids_staff='()')) OR ".$programs." json_contains(json_array(ids_staff),'".$staff_id."') ) ) "]] );
foreach ($entries as $entry) {
$entry['tags'] = is_null($entry['tags']) ? [] : json_decode($memo['tags']);
};
error_log(var_export($entries,true));
return $entries;
}
public static function updateClientMemo ($api, $args) {
$memo = $api->getArgs();
$memo['client_id'] = $args[1];
$memo['tags'] = is_null($memo['tags']) ? [] : json_encode($memo['tags']);
$memo['deleted'] = 0;
$memo['date'] = date_create_from_format('m/d/Y', $memo['date']);
$memo['reminder_date'] = date_create_from_format('m/d/Y h:i a',$memo['reminder_date']);
$memo['modified_at'] = date('Y-m-d H:i:s');
$memo['modified_by'] = $api->authentication->getUser()->id;
error_log(var_export($memo,true));
$entry = self::getEntry(['where' => ['id = ?', $memo['id']]]);
$entry->setData($memo);
return $entry->save();
}
Aucun commentaire:
Enregistrer un commentaire