Ejemplo n.º 1
0
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file add_approver.php
*/
include_once 'kernel/common/template.php';
#include_once( eZExtension::baseDirectory() . '/ezapprove2/classes/ezxapprovestatus.php' );
#include_once( eZExtension::baseDirectory() . '/ezapprove2/classes/ezapprove2event.php' );
$Module = $Params['Module'];
$approveStatusID = $Params['ApproveStatusID'];
$approveStatus = eZXApproveStatus::fetch($approveStatusID);
if (!$approveStatus) {
    eZDebug::writeError('Approve status not found.');
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if (!$approveStatus->isApprover(eZUser::currentUserID())) {
    eZDebug::writeError('User is not allowed to add new approvers.');
    return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$approveEvent = $approveStatus->attribute('approve2_event');
if (!$approveEvent) {
    eZDebug::writeDebug('Could not find approve event.');
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if (!$approveEvent->attribute('allow_add_approver')) {
    eZDebug::writeError('User is not allowed to add new approvers.');