function delete_tilkee_project(&$bean, $event, $arguments = null) { if ($event != 'before_delete') { return; } // appel de l'API de suppression du projet require_once 'custom/include/externalAPI/Tilkee/ExtAPITilkee.php'; $tilkee = new ExtAPITilkee(); $result = $tilkee->delete_project($this->tilkee_id); // No return info from the API so we expect it's realy deleted !!! // And delete linked tilks $bean->load_relationship('tilkee_projects_tilkee_tilks'); foreach ($bean->tilkee_projects_tilkee_tilks->getBeans() as $tilkee_tilks) { $tilkee_tilks->mark_deleted($tilkee_tilks->id); } }
if ($_REQUEST['project_name_create'] != '') { $result = $tilkee->create_project($_REQUEST['project_name_create']); $display_result = print_r($result, true); $display_title = "Create Project"; } break; case 'update_project': if ($_REQUEST['project_id_update'] != '') { $result = $tilkee->update_project($_REQUEST['project_id_update'], $_REQUEST['project_name_update'], $_REQUEST['project_kind'], $_REQUEST['project_won'], $_REQUEST['project_archived']); $display_result = print_r($result, true); $display_title = "Update Project"; } break; case 'delete_project': if ($_REQUEST['project_id_delete'] != '') { $result = $tilkee->delete_project($_REQUEST['project_id_delete']); $display_result = print_r($result, true); $display_title = "Delete Project"; } break; case 'infos_tilk': if ($_REQUEST['project_id_infos_tilk'] != '' && $_REQUEST['tilk_id_infos_tilk'] != '') { $result = $tilkee->infos_tilk($_REQUEST['project_id_infos_tilk'], $_REQUEST['tilk_id_infos_tilk']); $display_result = print_r($result, true); $display_title = "Infos Tillk"; } break; case 'create_tilk': if ($_REQUEST['project_id_create_tilk'] != '') { $result = $tilkee->create_tilk($_REQUEST['project_id_create_tilk'], $_REQUEST['tilk_name_create']); $display_result = print_r($result, true);