[Koha-devel] need for non-SQL in updater : got it !!!

MJ Ray mjr at phonecoop.coop
Mon Oct 1 17:59:54 CEST 2007


Paul POULAIN <paul.poulain at free.fr> wrote:
> Slef asked me "could you give me an example of something that can't be 
> ruled only by SQL during update". [...]
> When dealing with something that depends on language and/or MARC flavour.
>
> For example, I want to add a systempref for Reserve behaviour (to fix 
> http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1416)
>
> If langage is french, i'll add something, otherwise i'll add something else.

Why can't that be done with SQL like
INSERT INTO `systempreferences`
  (`variable`,`value`,`explanation`,`options`,`type`)
SELECT
  'ReservesNeedReturns',
  '0',
  CASE WHEN STRCMP(`value`,'fr')
    THEN 'Si ce paramètre est mis à 1, une réservation
posée sur un exemplaire présent sur le site devra être passée en
retour pour être disponible. Sinon, elle sera automatiquement
disponible, Koha considère que le bibliothécaire place la réservation
en ayant le document en mains'
    ELSE 'If set, a reserve done on an item
available in this branch need a check-in, otherwise, a reserve on a
specific item, that is on the branch & available is considered as
available' END,
  '',
  'YesNo'
  FROM `systempreferences` WHERE `variable` = 'opaclanguages'
  LIMIT 1;
?

(By the way, I don't understand why the fix to bug 1416 in commit
1a4fc157bfa17dee2a2122b9f86d1c598e063794 appears to depend on opac
languages being exactly 'fr' rather than merely containing 'fr' and 
why we don't note librarian/intranet language.)

In the longer-term, we probably should split explanation out into
another database table, to allow multi-lingual intranet use.

Hope that helps,
-- 
MJ Ray http://mjr.towers.org.uk/email.html tel:+44-844-4437-237 -
Webmaster-developer, statistician, sysadmin, online shop builder,
consumer and workers co-operative member http://www.ttllp.co.uk/ -
Writing on koha, debian, sat TV, Kewstoke http://mjr.towers.org.uk/





More information about the Koha-devel mailing list