Revision: 6479 http://care2002.svn.sourceforge.net/care2002/?rev=6479&view=rev Author: mizuko Date: 2010-06-30 12:09:27 +0000 (Wed, 30 Jun 2010)
Log Message: ----------- see #54 Added Paths: ----------- care2x/branches/gettext/modules/products/includes/inc_products_search_mod_database.php Removed Paths: ------------- care2x/branches/gettext/modules/products/includes/inc_products_search_mod_datenbank.php Copied: care2x/branches/gettext/modules/products/includes/inc_products_search_mod_database.php (from rev 6478, care2x/branches/gettext/modules/products/includes/inc_products_search_mod_datenbank.php) =================================================================== --- care2x/branches/gettext/modules/products/includes/inc_products_search_mod_database.php (rev 0) +++ care2x/branches/gettext/modules/products/includes/inc_products_search_mod_database.php 2010-06-30 12:09:27 UTC (rev 6479) @@ -0,0 +1,64 @@ +<?php +/*------begin------ This protection code was suggested by Luki R. l...@karet.org ---- */ +if (stristr ( 'inc_products_search_mod_database.php', $PHP_SELF )) + die ( '<meta http-equiv="refresh" content="0; url=../">' ); + /*------end------*/ +///$db->debug = true; +/** + * CARE 2002 Integrated Hospital Information System + * GNU General Public License + * Copyright 2002 Elpidio Latorilla + * elpi...@care2x.org, + * + * See the file "copy_notice.txt" for the licence notice + */ +if ($cat == 'pharma') { + $dbtable = 'care_pharma_products_main'; + $dbtablesub = 'care_pharma_products_main_sub'; +} else { + $dbtable = 'care_med_products_main'; + $dbtablesub = 'care_med_products_main_sub'; +} +// clean input data +$keyword = addslashes ( trim ( $keyword ) ); + +// this is the search module +if ((($mode == 'search') || $update) && ($keyword != '')) { + + if ($update) { + $sql = "SELECT * FROM $dbtable WHERE bestellnum='$keyword'"; + $ergebnis = $db->Execute ( $sql ); + $linecount = $ergebnis->RecordCount (); + } else { + $sql = "SELECT $dbtable.*, sum(pcs) as qty FROM $dbtable + LEFT OUTER JOIN $dbtablesub ON ( + $dbtablesub.bestellnum = $dbtable.bestellnum ) + WHERE $dbtable.bestellnum='$keyword' + OR artikelnum $sql_LIKE '$keyword' + OR industrynum $sql_LIKE '$keyword' + OR artikelname $sql_LIKE '$keyword' + OR generic $sql_LIKE '$keyword' + OR description $sql_LIKE '$keyword' + GROUP BY $dbtable.bestellnum"; + $ergebnis = $db->Execute ( $sql ); + + if (!$linecount = $ergebnis->RecordCount ()) { + $sql = "SELECT * FROM $dbtable WHERE bestellnum $sql_LIKE '$keyword%' + OR artikelnum $sql_LIKE '$keyword%' + OR industrynum $sql_LIKE '$keyword%' + OR artikelname $sql_LIKE '$keyword%' + OR generic $sql_LIKE '$keyword%' + OR description $sql_LIKE '$keyword%'"; + $ergebnis = $db->Execute ( $sql ); + $linecount = $ergebnis->RecordCount (); + } + } //end of if $update else + //if parent is order catalog + if (($linecount == 1) && $bcat) { + $ttl = $ergebnis->FetchRow (); + $ergebnis->MoveFirst (); + $title_art = $ttl ['artikelname']; + } +} + +?> Deleted: care2x/branches/gettext/modules/products/includes/inc_products_search_mod_datenbank.php =================================================================== --- care2x/branches/gettext/modules/products/includes/inc_products_search_mod_datenbank.php 2010-06-30 12:08:47 UTC (rev 6478) +++ care2x/branches/gettext/modules/products/includes/inc_products_search_mod_datenbank.php 2010-06-30 12:09:27 UTC (rev 6479) @@ -1,64 +0,0 @@ -<?php -/*------begin------ This protection code was suggested by Luki R. l...@karet.org ---- */ -if (stristr ( 'inc_products_search_mod_database.php', $PHP_SELF )) - die ( '<meta http-equiv="refresh" content="0; url=../">' ); - /*------end------*/ -///$db->debug = true; -/** - * CARE 2002 Integrated Hospital Information System - * GNU General Public License - * Copyright 2002 Elpidio Latorilla - * elpi...@care2x.org, - * - * See the file "copy_notice.txt" for the licence notice - */ -if ($cat == 'pharma') { - $dbtable = 'care_pharma_products_main'; - $dbtablesub = 'care_pharma_products_main_sub'; -} else { - $dbtable = 'care_med_products_main'; - $dbtablesub = 'care_med_products_main_sub'; -} -// clean input data -$keyword = addslashes ( trim ( $keyword ) ); - -// this is the search module -if ((($mode == 'search') || $update) && ($keyword != '')) { - - if ($update) { - $sql = "SELECT * FROM $dbtable WHERE bestellnum='$keyword'"; - $ergebnis = $db->Execute ( $sql ); - $linecount = $ergebnis->RecordCount (); - } else { - $sql = "SELECT $dbtable.*, sum(pcs) as qty FROM $dbtable - LEFT OUTER JOIN $dbtablesub ON ( - $dbtablesub.bestellnum = $dbtable.bestellnum ) - WHERE $dbtable.bestellnum='$keyword' - OR artikelnum $sql_LIKE '$keyword' - OR industrynum $sql_LIKE '$keyword' - OR artikelname $sql_LIKE '$keyword' - OR generic $sql_LIKE '$keyword' - OR description $sql_LIKE '$keyword' - GROUP BY $dbtable.bestellnum"; - $ergebnis = $db->Execute ( $sql ); - - if (!$linecount = $ergebnis->RecordCount ()) { - $sql = "SELECT * FROM $dbtable WHERE bestellnum $sql_LIKE '$keyword%' - OR artikelnum $sql_LIKE '$keyword%' - OR industrynum $sql_LIKE '$keyword%' - OR artikelname $sql_LIKE '$keyword%' - OR generic $sql_LIKE '$keyword%' - OR description $sql_LIKE '$keyword%'"; - $ergebnis = $db->Execute ( $sql ); - $linecount = $ergebnis->RecordCount (); - } - } //end of if $update else - //if parent is order catalog - if (($linecount == 1) && $bcat) { - $ttl = $ergebnis->FetchRow (); - $ergebnis->MoveFirst (); - $title_art = $ttl ['artikelname']; - } -} - -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Care2002-developers mailing list Care2002-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/care2002-developers