parent
534b59edac
commit
b777353054
3 changed files with 38 additions and 9 deletions
|
|
@ -62,21 +62,28 @@ if ( isset ($_POST['remove_line']))
|
|||
/*******************************************************************************************/
|
||||
if ( isset ($_POST['remove_cat']))
|
||||
{
|
||||
$fd_id=new Fiche_Def($cn,$_POST['fd_id']);
|
||||
$remains=$fd_id->remove();
|
||||
if ( $remains != 0 )
|
||||
/* some card are not removed because it is used */
|
||||
alert(_('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées'."\n".
|
||||
'Les fiches non utilisées ont cependant été effacées'));
|
||||
$post_id=HtmlInput::default_value_post('fd_id', 0);
|
||||
if ($post_id == 0 || $post_id >= 500000)
|
||||
{
|
||||
alert(_('Impossible d\'enlever cette catégorie'));
|
||||
} else {
|
||||
$fd_id=new Fiche_Def($cn,$post_id);
|
||||
$remains=$fd_id->remove();
|
||||
if ( $remains != 0 ) {
|
||||
/* some card are not removed because it is used */
|
||||
alert(_('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées'."\n".
|
||||
'Les fiches non utilisées ont cependant été effacées'));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************************************************************************************/
|
||||
// Change some basis info
|
||||
/*******************************************************************************************/
|
||||
if ( isset ($_POST['change_name']))
|
||||
{
|
||||
if (isset ($_REQUEST['label']) )
|
||||
if (isset ($_REQUEST['label']) )
|
||||
{
|
||||
$fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']);
|
||||
$fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']);
|
||||
$fiche_def->SaveLabel($_REQUEST['label']);
|
||||
if ( isset($_REQUEST['create']))
|
||||
{
|
||||
|
|
@ -87,7 +94,7 @@ if ( isset ($_POST['change_name']))
|
|||
$fiche_def->set_autocreate(false);
|
||||
}
|
||||
$fiche_def->save_class_base($_REQUEST['class_base']);
|
||||
$fiche_def->save_description($_REQUEST['fd_description']);
|
||||
$fiche_def->save_description($_REQUEST['fd_description']);
|
||||
|
||||
}
|
||||
echo $fiche_def->input_detail();
|
||||
|
|
|
|||
|
|
@ -683,6 +683,9 @@ $order
|
|||
*/
|
||||
function remove()
|
||||
{
|
||||
if ( $this->id >= 500000 ) {
|
||||
throw new Exception(_('Catégorie verrouillée '));
|
||||
}
|
||||
$remain=0;
|
||||
/* get all the card */
|
||||
$aFiche=fiche::get_fiche_def($this->cn,$this->id);
|
||||
|
|
|
|||
|
|
@ -161,3 +161,22 @@ ALTER TABLE action_gestion ADD CONSTRAINT fiche_f_id_fk3 FOREIGN KEY (f_id_dest
|
|||
alter table action_gestion alter f_id_dest drop not null;
|
||||
update action_gestion set f_id_dest = null where f_id_dest = 0;
|
||||
|
||||
CREATE OR REPLACE FUNCTION comptaproc.category_card_before_delete()
|
||||
RETURNS trigger AS
|
||||
$BODY$
|
||||
|
||||
begin
|
||||
if OLD.fd_id > 499000 then
|
||||
return null;
|
||||
end if;
|
||||
return OLD;
|
||||
|
||||
end;
|
||||
$BODY$
|
||||
language plpgsql;
|
||||
|
||||
CREATE TRIGGER trg_category_card_before_delete
|
||||
BEFORE delete
|
||||
ON fiche_def
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE comptaproc.category_card_before_delete();
|
||||
Loading…
Add table
Add a link
Reference in a new issue