function Translate($po) { echo "translating ...<br />\n"; if (is_string($po)) { $poObj = new po(); $poObj->Load($po); $po = $poObj; } if (get_class($po) == "po") { foreach ($this->objects as $objKey => $value) { foreach ($value["STRINGS"] as $key => $string) { $translation = $po->Translate($string); if ($translation != "") { $this->objects[$objKey]["STRINGS"][$key] = $translation; } } } } else { echo "Wrong parameter to translate<br />"; } echo "done<br />\n"; }
if (!is_number($po_no)) { print_error('[x][po001]Invalid PO number'); exit; } switch ($po_action) { case 'deletepo': //check user permission, and this function is for office if (!require_office()) { print_error('[x][er003]Permission Deny for Retail Shop'); } //get po detail if (!$po_no) { print_error('[x][po002]No PO number'); exit; } $po = new po($po_no); if ($po->get_errmsg()) { print_error($po->get_errmsg()); exit; } $po_data = $po->get_po(); //print_object(unserialize($po_data_sered)); switch ($po_data->postate_no) { //after get po data, check the poState_no is = 1, is mean 開啟 -- 等待到貨, with can delete it directly case 1: //save the data to db and delete the record $serialize_po = ''; $serialize_po = $po->get_serialize_po(); if (!empty($serialize_po)) { $insert_obj = new stdClass(); $insert_obj->receipttype = 'po';
//echo "</pre>"; // find corrensponding pot file $potrecord = NULL; foreach ($info as $potrec) { if ($potrec["Po_Type"] !== "pot") { continue; } if ($potrec["Po_Path"] == $record["Po_Path"] && $potrec["Po_Name"] == $record["Po_Name"]) { $potrecord = $potrec; echo "<h3>" . $potrecord["Name"] . "</h3>"; } } echo $potrecord; $pot = $potrecord["Po_File"]; if ($record["Po_Updated"] || $potrecord["Po_Updated"]) { $po = new po(); //$po->Load($dir.$record["Path"], ""); $po->Load($record["Path"], ""); $total = $po->getStringCount(); $record["Po_File"] = $po; $po->BuildReport($pot); echo "<br>\nupdate"; $translated = 0; $group = $record["Po_Group"]; $lang = $record["Po_Lang"]; $count = $po->GetErrorCount($type); $query = "REPLACE INTO state (`revision`, `group`, `language`) VALUES({$currentRev}, '{$group}', '{$lang}')"; echo "<li>" . $query . "</li>"; $res = mysql_query($query, $db); if ($res === false) { echo "<br>\n<i>{$query}</i> <b>" . mysql_error() . "</b><br>\n";