Example #1
0
//	Date		: 94.08
//-----------------------------
require_once '../header.inc.php';
require_once 'contract.class.php';
require_once '../templates/templates.class.php';
$CntObj = new CNT_contracts($_REQUEST['ContractID']);
$ContractRecord = CNT_contracts::Get(false, " AND ContractID=?", array($CntObj->ContractID));
$ContractRecord = $ContractRecord->fetch();
$temp = CNT_TemplateItems::Get(" AND TemplateID in(0,?)", array($CntObj->TemplateID));
$TplItems = $temp->fetchAll();
$TplItemsStore = array();
foreach ($TplItems as $it) {
    $TplItemsStore[$it['TemplateItemID']] = $it;
}
$res = explode(CNTconfig::TplItemSeperator, $CntObj->content);
$CntItems = CNT_ContractItems::GetContractItems($CntObj->ContractID);
$ValuesStore = array();
foreach ($CntItems as $it) {
    $ValuesStore[$it['TemplateItemID']] = $it['ItemValue'];
}
if (substr($CntObj->content, 0, 3) == CNTconfig::TplItemSeperator) {
    $res = array_merge(array(''), $res);
}
$st = '';
for ($i = 0; $i < count($res); $i++) {
    if ($i % 2 != 0) {
        if (isset($ValuesStore[$res[$i]])) {
            switch ($TplItemsStore[$res[$i]]["ItemType"]) {
                case 'shdatefield':
                    $st .= DateModules::miladi_to_shamsi($ValuesStore[$res[$i]]);
                    break;
Example #2
0
function DeleteContract()
{
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    $obj = new CNT_contracts($_POST['ContractID']);
    $result = CNT_ContractItems::RemoveAll($obj->ContractID, $pdo);
    $result = $obj->Remove();
    if (!$result) {
        $pdo->rollBack();
        //print_r(ExceptionHandler::PopAllExceptions());
        //echo PdoDataAccess::GetLatestQueryString();
        echo Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString());
        die;
    }
    $pdo->commit();
    echo Response::createObjectiveResponse(true, '');
    die;
}