• Resolved solarman2

    (@solarman2)


    How do I increase the number of allowed digits in a Patron telephone field?

    In the file WEBLIB_PatronRecord_Admin.php below if I increase the value 10 the patron is not added if their phone number has more than 10 digits

    $newtelephone = WEBLIB_Patrons_Admin::striptelephonedashes($_REQUEST[‘telephone’]);
    if (!preg_match(‘/^\d+$/’,$newtelephone) && strlen($newtelephone) != 10) {
    $result .= ‘
    <span id=”error”>’.__(‘Telephone invalid’,’web-librarian’) . ‘</span>’;

    https://wordpress.org/plugins/weblibrarian/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter solarman2

    (@solarman2)

    I think I may have solved this, but the fix may not be the best solution as it would seem to conflict with the value in WEBLIB_PatronRecord_Admin.php above, so I would still appreciate feedback from the author when he can manage.

    My solution was to edit the weblib_patrons table in the database, and increase the telephone char(10) to accomodate longer telephone numbers

    Thread Starter solarman2

    (@solarman2)

    PLEASE NOTE:
    Where I have mentioned WEBLIB_PatronRecord_Admin.php
    I should have said WEBLIB_Patrons_Admin.php

    My solution does not work with State length.
    I need to be able to have more than 2 characters but adding to the database does not work for state and changing !=2 in WEBLIB_Patrons_Admin.php to another value does not add the new patron

    Plugin Author Robert Heller

    (@robertpheller)

    You need to modify the database table setup in database_code.php as well.

    Both the telephone and state fields were coded with telephone numbers and state abbreviations suitable to how things are in the USA. This code was never designed for use outside of the USA. It is open source, so a reasonable compentent PHP program should be able to adapt it as needed.

    Plugin Author Robert Heller

    (@robertpheller)

    Please check the support thread at

    https://wordpress.org/support/topic/can-patrons-have-postal-code-rather-than-zip-code

    For information about ‘forking’ the plugin to maintain custom changes (eg non USA telephone numbers, zip/postal codes. states, etc.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Allowed number of telephone digits’ is closed to new replies.