Commit 3946dacc authored by Jean-Paul Saman's avatar Jean-Paul Saman

Cleanup tabs and replace them by spaces.

parent ccd99123
<?php <?php
/* /*
* Copyright (C) 2007, M2X * Copyright (C) 2007-2008, M2X
* *
* Authors: Jean-Paul Saman * Authors: Jean-Paul Saman
* *
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
// create a new instance of the timesheet class // create a new instance of the timesheet class
$obj = new CTimesheet(); $obj = new CTimesheet();
$msg = ''; // reset the message string $msg = ''; // reset the message string
// bind the informations (variables) retrieved via post to the timesheet object // bind the informations (variables) retrieved via post to the timesheet object
if (!$obj->bind( $_POST )) { if (!$obj->bind( $_POST )) {
$AppUI->setMsg( $obj->getError(), UI_MSG_ERROR ); $AppUI->setMsg( $obj->getError(), UI_MSG_ERROR );
$AppUI->redirect(); $AppUI->redirect();
} }
// detect if a deleete operation has to be processed // detect if a deleete operation has to be processed
...@@ -43,47 +43,45 @@ $obj->timesheet_worked = $_POST["timesheet_worked"]; ...@@ -43,47 +43,45 @@ $obj->timesheet_worked = $_POST["timesheet_worked"];
$AppUI->setMsg( 'Timesheet' ); $AppUI->setMsg( 'Timesheet' );
if ($del) { if ($del) {
// check if there are dependencies on this object // check if there are dependencies on this object
if (!$obj->canDelete( $msg )) { if (!$obj->canDelete( $msg )) {
$AppUI->setMsg( $msg, UI_MSG_ERROR ); $AppUI->setMsg( $msg, UI_MSG_ERROR );
$AppUI->redirect(); $AppUI->redirect();
} }
// see how easy it is to run database commands with the object oriented architecture ! // see how easy it is to run database commands with the object oriented architecture !
// simply delete a quote from db and have detailed error or success report // simply delete a quote from db and have detailed error or success report
if ($msg = $obj->delete()) { if ($msg = $obj->delete()) {
$AppUI->setMsg( $msg, UI_MSG_ERROR ); $AppUI->setMsg( $msg, UI_MSG_ERROR );
$AppUI->redirect(); $AppUI->redirect();
} else { } else {
$AppUI->setMsg( "Timesheet deleted", UI_MSG_ALERT); $AppUI->setMsg( "Timesheet deleted", UI_MSG_ALERT);
$AppUI->redirect( "m=timesheet" ); $AppUI->redirect( "m=timesheet" );
} }
} } else if ($stat) {
else if ($stat) { if ($msg = $obj->change_status($obj->timesheet_status)) {
if ($msg = $obj->change_status($obj->timesheet_status)) { $AppUI->setMsg( $msg, UI_MSG_ERROR );
$AppUI->setMsg( $msg, UI_MSG_ERROR ); $AppUI->redirect();
$AppUI->redirect(); } else {
} else { $AppUI->setMsg( "Timesheet status updated", UI_MSG_ALERT);
$AppUI->setMsg( "Timesheet status updated", UI_MSG_ALERT); $AppUI->redirect( "m=timesheet&a=addedit&timesheet_id=".$obj->timesheet_id );
$AppUI->redirect( "m=timesheet&a=addedit&timesheet_id=".$obj->timesheet_id ); }
} } else if ($period) {
} if ($msg = $obj->change_period($obj->timesheet_period)) {
else if ($period) { $AppUI->setMsg( $msg, UI_MSG_ERROR );
if ($msg = $obj->change_period($obj->timesheet_period)) { $AppUI->redirect();
$AppUI->setMsg( $msg, UI_MSG_ERROR ); } else {
$AppUI->redirect(); $AppUI->setMsg( "Timesheet period changed", UI_MSG_ALERT);
} else { $AppUI->redirect( "m=timesheet&a=addedit&timesheet_id=".$obj->timesheet_id );
$AppUI->setMsg( "Timesheet period changed", UI_MSG_ALERT); }
$AppUI->redirect( "m=timesheet&a=addedit&timesheet_id=".$obj->timesheet_id ); } else {
} // simply store the added/edited quote in database via the store method of the timesheet
} // child class of the CDpObject provided ba the dPFramework
else { if (($msg = $obj->store())) {
// simply store the added/edited quote in database via the store method of the timesheet $AppUI->setMsg( $msg, UI_MSG_ERROR );
// child class of the CDpObject provided ba the dPFramework } else {
if (($msg = $obj->store())) { $isNotNew = $_POST['timesheet_id'];
$AppUI->setMsg( $msg, UI_MSG_ERROR ); $AppUI->setMsg( $isNotNew ? 'Timesheet updated' : 'Timesheet inserted', UI_MSG_OK);
} else { }
$isNotNew = @$_POST['timesheet_id']; $AppUI->redirect("m=timesheet" );
$AppUI->setMsg( $isNotNew ? 'Timesheet updated' : 'Timesheet inserted', UI_MSG_OK);
} $AppUI->redirect("m=timesheet" );
} }
?> ?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment