コード例 #1
0
function pvVerifyInterventions(&$CI, &$cSchema, $lTableID)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $checkBoxes = array('Companionship' => pvStrFieldInternalName('Companionship', $lTableID, $cSchema), 'Caregiver Relief' => pvStrFieldInternalName('Caregiver Relief', $lTableID, $cSchema), 'Emotional Support' => pvStrFieldInternalName('Emotional Support', $lTableID, $cSchema), 'Socialization' => pvStrFieldInternalName('Socialization', $lTableID, $cSchema), 'Bereavement' => pvStrFieldInternalName('Bereavement', $lTableID, $cSchema), 'Telephone Call' => pvStrFieldInternalName('Telephone Call', $lTableID, $cSchema), 'Excursion / Errands' => pvStrFieldInternalName('Excursion / Errands', $lTableID, $cSchema), 'Music / Pet / Art Support' => pvStrFieldInternalName('Music / Pet / Art Support', $lTableID, $cSchema), 'Food Preparation' => pvStrFieldInternalName('Food Preparation', $lTableID, $cSchema), 'Household Chores' => pvStrFieldInternalName('Household Chores', $lTableID, $cSchema), 'Other intervention' => pvStrFieldInternalName('Other intervention', $lTableID, $cSchema));
    $bAnyChecked = pvBAnyChecked($checkBoxes);
    if (!$bAnyChecked) {
        setCFormErrorMessage($checkBoxes['Other intervention'], 'Please indicate the <b>Intervention</b>.');
        return false;
    }
    // if "Other" is checked, notes are required
    $strOtherNotesFN = pvStrFieldInternalName('Notes (Other intervention)', $lTableID, $cSchema);
    if (@$_POST[$checkBoxes['Other intervention']] == 'true' && trim($_POST[$strOtherNotesFN]) == '') {
        setCFormErrorMessage($strOtherNotesFN, 'Please provide notes about <b>Other Intervention</b>.');
        return false;
    }
    return true;
}
コード例 #2
0
function verifyCustomFormCurrency($strVal, $strOpts)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $strCurrency = trim($strVal);
    $strCurrency = stripCustomCommas($strCurrency);
    $opts = explode(',', $strOpts);
    $bRequired = $opts[0] == 'true';
    $strFN = trim($opts[1]);
    $strLabel = trim($opts[2]);
    if ($bRequired) {
        if ($strCurrency == '') {
            //            $ErrMessages[$strFN] = '<div class="formError">'.'The '.$strLabel.' field is required.</div>';
            setCFormErrorMessage($strFN, 'The ' . $strLabel . ' field is required.');
            return false;
        }
    } elseif ($strVal == '') {
        return '';
    }
    if (!is_numeric($strCurrency)) {
        //         $ErrMessages[$strFN] = '<div class="formError">'.'The '.$strLabel.' amount is not valid.</div>';
        setCFormErrorMessage($strFN, 'The ' . $strLabel . ' amount is not valid.');
        return false;
    } else {
        return $strCurrency;
    }
}