コード例 #1
0
function customFieldErrors($biblio)
{
    require_once "../classes/MaterialFieldQuery.php";
    $matQ = new MaterialFieldQuery();
    $matQ->connect();
    $rows = $matQ->get($biblio->getMaterialCd());
    $matQ->close();
    $errors = array();
    $fields = $biblio->getBiblioFields();
    foreach ($rows as $row) {
        $idx = sprintf('%03d%s', $row['tag'], $row['subfieldCd']);
        if ($row['required'] == 'Y') {
            if (!isset($fields[$idx]) or $fields[$idx]->getFieldData() == '') {
                $errors[$idx] = 'Field is required.';
            }
        }
    }
    return $errors;
}
コード例 #2
0
#****************************************************************************
#*  Validate data
#****************************************************************************
$fld = new BiblioField();
$fld->setTag($_POST["tag"]);
$fld->setSubfieldCd($_POST["subfieldCd"]);
$pageErrors = array();
$validData = $fld->validateData();
if (!$validData) {
    $pageErrors["tag"] = $fld->getTagError();
    $pageErrors["subfieldCd"] = $fld->getSubfieldCdError();
}
if (!$rec['descr']) {
    $pageErrors['descr'] = 'Field is required.';
}
if (!empty($pageErrors)) {
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../admin/custom_marc_edit_form.php");
    exit;
}
$matQ = new MaterialFieldQuery();
$matQ->connect();
$matQ->update($rec);
$matQ->close();
$msg = "Field Updated successfully";
header("Location: custom_marc_view.php?materialCd=" . U($rec['materialCd']) . "&msg=" . U($msg));
include "../shared/footer.php";
?>
    
コード例 #3
0
$rec['required'] = $_POST["required"];
$rec['cntrltype'] = $_POST["cntrltype"];
$fld = new BiblioField();
$fld->setTag($_POST["tag"]);
$fld->setSubfieldCd($_POST["subfieldCd"]);
$pageErrors = array();
$validData = $fld->validateData();
if (!$validData) {
    $pageErrors["tag"] = $fld->getTagError();
    $pageErrors["subfieldCd"] = $fld->getSubfieldCdError();
}
if (!$rec['descr']) {
    $pageErrors['descr'] = 'Field is required.';
}
if (!empty($pageErrors)) {
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../admin/custom_marc_add_form.php");
    exit;
}
$matQ = new MaterialFieldQuery();
$matQ->connect();
$matQ->insert($rec);
$matQ->close();
unset($_SESSION["postVars"]);
unset($_SESSION["pageErrors"]);
$msg = "New Field Added Successfully ";
header("Location: custom_marc_view.php?materialCd=" . U($rec['materialCd']) . "&msg=" . U($msg));
?>
    
コード例 #4
0
$dmQ->close();
echo $msg;
?>
<br>	
<a href="custom_marc_add_form.php?materialCd=<?php 
echo HURL($materialCd);
?>
&amp;reset=Y"><?php 
echo $loc->getText('materialAddCustomMarc');
?>
</a> (<?php 
echo H($dm->getDescription());
?>
)<br><br>
<?php 
$matQ = new MaterialFieldQuery();
$matQ->connect();
$rows = $matQ->get($materialCd);
$matQ->close();
if (empty($rows)) {
    echo $loc->getText("No fields found!");
} else {
    ?>

<table class="primary">
<tr>
<th colspan="2" valign="top">
<?php 
    echo $loc->getText("admin_materials_listFunction");
    ?>
</th>
コード例 #5
0
require_once "../shared/logincheck.php";
require_once "../catalog/marcFuncs.php";
require_once "../classes/MaterialFieldQuery.php";
require_once "../classes/Localize.php";
$loc = new Localize(OBIB_LOCALE, $tab);
$postVars = array();
$pageErrors = array();
if (isset($_GET["xref_id"])) {
    $xref_id = $_GET["xref_id"];
    $postVars["xref_id"] = $xref_id;
    if (!isset($_GET["materialCd"])) {
        Fatal::internalError('no material code set');
    }
    $materialCd = $_GET["materialCd"];
    $postVars["materialCd"] = $materialCd;
    $matQ = new MaterialFieldQuery();
    $matQ->connect();
    $row = $matQ->get1($xref_id);
    $matQ->close();
    if ($row === NULL) {
        Fatal::internalError('bad xref ID');
    }
    $postVars["tag"] = $row["tag"];
    $postVars["subfieldCd"] = $row["subfieldCd"];
    $postVars["descr"] = $row["descr"];
    $postVars["required"] = $row["required"];
    $postVars["cntrltype"] = $row["cntrltype"];
} else {
    if (isset($_SESSION['postVars'])) {
        $postVars = $_SESSION['postVars'];
        if (isset($_SESSION['pageErrors'])) {
コード例 #6
0
<?php

/* This file is part of a copyrighted work; it is distributed with NO WARRANTY.
 * See the file COPYRIGHT.html for more details.
 */
require_once "../shared/common.php";
$tab = 'admin';
require_once "../shared/logincheck.php";
require_once "../classes/MaterialFieldQuery.php";
if (!isset($_GET["xref_id"])) {
    Fatal::internalError('xfref_id not set');
}
$matQ = new MaterialFieldQuery();
$matQ->connect();
$matQ->delete($_GET["xref_id"]);
$matQ->close();
$msg = "Field Successfully Deleted";
header("Location: custom_marc_view.php?materialCd=" . U($_GET["materialCd"]) . "&msg=" . U($msg));
コード例 #7
0
ファイル: materials_del.php プロジェクト: vishnu35/Granthalay
    exit;
}
$code = $_GET["code"];
$description = $_GET["desc"];
#**************************************************************************
#*  Delete row
#**************************************************************************
$dmQ = new DmQuery();
$dmQ->connect();
$dmQ->delete("material_type_dm", $code);
$dmQ->close();
$checkoutPrivsQ = new CheckoutPrivsQuery();
$checkoutPrivsQ->connect();
$checkoutPrivsQ->delete_by_material_cd($code);
$checkoutPrivsQ->close();
$materialFieldQ = new MaterialFieldQuery();
$materialFieldQ->connect();
$materialFieldQ->deleteCustomField($code);
$materialFieldQ->close();
#**************************************************************************
#*  Show success page
#**************************************************************************
require_once "../shared/header.php";
echo $loc->getText("admin_materials_delMaterialType");
echo H($description);
echo $loc->getText("admin_materials_delMaterialdeleted");
?>
<br><br>
<a href="../admin/materials_list.php"><?php 
echo $loc->getText("admin_materials_Return");
?>