/** * Fetch item_id for item with specified idno in list * * @param string $ps_list List code or list label * @return int list_id of list or null if no matching list was found */ function caGetListID($ps_list) { $t_list = new ca_lists(); if (is_numeric($ps_list)) { if ($t_list->load((int) $ps_list)) { return $t_list->getPrimaryKey(); } } if ($t_list->load(array('list_code' => $ps_list))) { return $t_list->getPrimaryKey(); } $t_label = new ca_list_labels(); if ($t_label->load(array('name' => $ps_list))) { return $t_label->get('list_id'); } return null; }
function caGetListID($ps_list) { global $g_list_id_cache; if (isset($g_list_id_cache[$ps_list])) { return $g_list_id_cache[$ps_list]; } $t_list = new ca_lists(); if (is_numeric($ps_list)) { if ($t_list->load((int) $ps_list)) { return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey(); } } if ($t_list->load(array('list_code' => $ps_list))) { return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey(); } $t_label = new ca_list_labels(); if ($t_label->load(array('name' => $ps_list))) { return $g_list_id_cache[$ps_list] = $t_label->get('list_id'); } return $g_list_id_cache[$ps_list] = null; }
function caGetListID($ps_list, $pa_options = null) { global $g_list_id_cache; if (isset($g_list_id_cache[$ps_list])) { return $g_list_id_cache[$ps_list]; } $t_list = new ca_lists(); if ($o_trans = caGetOption('transaction', $pa_options, null)) { $t_list->setTransaction($o_trans); } if (is_numeric($ps_list)) { if ($t_list->load((int) $ps_list)) { return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey(); } } if ($t_list->load(array('list_code' => $ps_list))) { return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey(); } $t_label = new ca_list_labels(); if ($t_label->load(array('name' => $ps_list))) { return $g_list_id_cache[$ps_list] = $t_label->get('list_id'); } return $g_list_id_cache[$ps_list] = null; }