From 634810b8b329dc07b08182825ed4dd5fa8e8d02f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 24 Jan 2019 18:40:41 +0100 Subject: [PATCH 1/5] NEW conditionnal add member button by statut --- htdocs/adherents/type.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c32c7f6de61..a9e4752e292 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -427,8 +427,13 @@ if ($rowid > 0) } // Add + if ($user->rights->adherent->configurer && !empty($object->statut)) + { print '
'.$langs->trans("AddMember").'
'; - + } else { + print '
'.$langs->trans("AddMember").'
'; + } + // Delete if ($user->rights->adherent->configurer) { From 7197f43c3af4b832a1513b1dbaca0a90b096cb68 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 24 Jan 2019 19:23:01 +0100 Subject: [PATCH 2/5] manage statut type --- htdocs/adherents/type.php | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index a9e4752e292..b98b2f49e29 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -57,6 +57,7 @@ if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="d.lastname"; } $label=GETPOST("label","alpha"); +$statut=GETPOST("statut","int"); $subscription=GETPOST("subscription","int"); $vote=GETPOST("vote","int"); $comment=GETPOST("comment",'alphanohtml'); @@ -104,6 +105,7 @@ if ($cancel) { if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); + $object->statut = trim($statut); $object->subscription = (int) trim($subscription); $object->note = trim($comment); $object->mail_valid = trim($mail_valid); @@ -157,6 +159,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) $object->oldcopy = clone $object; $object->label = trim($label); + $object->statut = trim($statut); $object->subscription = (int) trim($subscription); $object->note = trim($comment); $object->mail_valid = trim($mail_valid); @@ -214,7 +217,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') { //dol_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql.= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -257,6 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''.$langs->trans("Label").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("VoteAllowed").''; + print ''.$langs->trans("Status").''; print ' '; print "\n"; @@ -278,6 +282,10 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''.dol_escape_htmltag($objp->label).''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; + print ''; +if ( !empty($objp->statut) ) print img_picto($langs->trans("InActivity"),'statut4'); +else print img_picto($langs->trans("ActivityCeased"),'statut5'); + print ''; if ($user->rights->adherent->configurer) print 'rowid.'">'.img_edit().''; else @@ -319,7 +327,11 @@ if ($action == 'create') print ''.$langs->trans("Label").''; - print ''.$langs->trans("SubscriptionRequired").''; + print ''.$langs->trans("Status").''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); + print ''; + + print ''.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription",1,1); print ''; @@ -392,6 +404,11 @@ if ($rowid > 0) print ''; + print ''; + print ''; @@ -427,13 +444,8 @@ if ($rowid > 0) } // Add - if ($user->rights->adherent->configurer && !empty($object->statut)) - { print ''; - } else { - print ''; - } - + // Delete if ($user->rights->adherent->configurer) { @@ -728,7 +740,11 @@ if ($rowid > 0) print ''; - print ''; + + print ''; From 2aa2cd331ef8a766ac7e4e3c40856818aecefee4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 24 Jan 2019 19:26:36 +0100 Subject: [PATCH 3/5] Update type.php --- htdocs/adherents/type.php | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index b98b2f49e29..4c4bf6e2637 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -105,8 +105,8 @@ if ($cancel) { if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); - $object->statut = trim($statut); - $object->subscription = (int) trim($subscription); + $object->statut = trim($statut); + $object->subscription = (int) trim($subscription); $object->note = trim($comment); $object->mail_valid = trim($mail_valid); $object->vote = (boolean) trim($vote); @@ -159,8 +159,8 @@ if ($action == 'update' && $user->rights->adherent->configurer) $object->oldcopy = clone $object; $object->label = trim($label); - $object->statut = trim($statut); - $object->subscription = (int) trim($subscription); + $object->statut = trim($statut); + $object->subscription = (int) trim($subscription); $object->note = trim($comment); $object->mail_valid = trim($mail_valid); $object->vote = (boolean) trim($vote); @@ -245,7 +245,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; - print ''; + print ''; print ''; print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); @@ -260,7 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -282,10 +282,10 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; - print ''; +else print img_picto($langs->trans("ActivityCeased"),'statut5'); + print ''; if ($user->rights->adherent->configurer) print ''; else @@ -328,10 +328,10 @@ if ($action == 'create') print ''; print ''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); + print ''; - print ''; @@ -351,7 +351,7 @@ if ($action == 'create') // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); @@ -404,9 +404,9 @@ if ($rowid > 0) print '
'.$langs->trans("Status").''; + if ( !empty($object->statut) ) print img_picto($langs->trans('TypeStatusActive'),'statut4').' '.$langs->trans("InActivity"); + else print img_picto($langs->trans('TypeStatusInactive'),'statut5').' '.$langs->trans("ActivityCeased"); + print '
'.$langs->trans("SubscriptionRequired").''; print yn($object->subscription); print '
'.$langs->trans("Label").'
'.$langs->trans("SubscriptionRequired").''; + print '
'.$langs->trans("Status").''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); + print '
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription",$object->subscription,1); print '
'.$langs->trans("Label").''.$langs->trans("SubscriptionRequired").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").''.$langs->trans("Status").' 
'.dol_escape_htmltag($objp->label).''.yn($objp->subscription).''.yn($objp->vote).''; + print ''; if ( !empty($objp->statut) ) print img_picto($langs->trans("InActivity"),'statut4'); -else print img_picto($langs->trans("ActivityCeased"),'statut5'); - print 'rowid.'">'.img_edit().'
'.$langs->trans("Label").'
'.$langs->trans("Status").''; - print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); - print '
'.$langs->trans("SubscriptionRequired").''; + print '
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription",1,1); print '
'; - print ''; print ''; print "\n"; @@ -741,10 +741,10 @@ if ($rowid > 0) print ''; print ''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); + print ''; - print ''; @@ -764,7 +764,7 @@ if ($rowid > 0) // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); From a0142a73a58907a5f7437858caf4307e41526a54 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 24 Jan 2019 19:30:36 +0100 Subject: [PATCH 4/5] Update type.php --- htdocs/adherents/type.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4c4bf6e2637..c1ce5c2c294 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -444,7 +444,12 @@ if ($rowid > 0) } // Add - print ''; + if ( $user->rights->adherent->configurer && !empty($object->statut) ) + { + print ''; + } else { + print ''; + } // Delete if ($user->rights->adherent->configurer) From 13ff5f9804a914d1ce8c227e1eb9c25532b1e3bd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 24 Jan 2019 21:32:40 +0100 Subject: [PATCH 5/5] Fix travis & Blank line --- htdocs/website/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 31fc81280c2..f67160bf6d8 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1858,7 +1858,6 @@ if (! GETPOST('hide_websitemenu')) } print $form->textwithpicto($linktotestonwebserver, $htmltext, 1, 'none', 'valignmiddle', 0, 2, 'helpvirtualhost'); print ''; - } if (in_array($action, array('editcss','editmenu','file_manager')))
'.$langs->trans("Status").''; + print '
'.$langs->trans("Status").''; if ( !empty($object->statut) ) print img_picto($langs->trans('TypeStatusActive'),'statut4').' '.$langs->trans("InActivity"); - else print img_picto($langs->trans('TypeStatusInactive'),'statut5').' '.$langs->trans("ActivityCeased"); + else print img_picto($langs->trans('TypeStatusInactive'),'statut5').' '.$langs->trans("ActivityCeased"); print '
'.$langs->trans("SubscriptionRequired").''; @@ -593,8 +593,8 @@ if ($rowid > 0) print ''; print ''; - print '  '; - print ''; + print '  '; + print ''; print '
'.$langs->trans("Label").'
'.$langs->trans("Status").''; - print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); - print '
'.$langs->trans("SubscriptionRequired").''; + print '
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription",$object->subscription,1); print '