54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
// Vendors
|
|
require_once 'ripcord/ripcord.php';
|
|
require '../config/config.inc.php';
|
|
require 'ErpTools.php';
|
|
require 'config.php';
|
|
|
|
if (empty($_GET['token']) || $_GET['token'] !== ERP_SCRIPT_TOKEN) {
|
|
die;
|
|
}
|
|
|
|
$models = ripcord::client("$url/xmlrpc/2/object");
|
|
|
|
$ids = $models->execute_kw($db, $uid, $password,
|
|
'res.partner.category', 'search', array(array(array('active', '=', true)))
|
|
);
|
|
|
|
$tags = $models->execute_kw($db, $uid, $password,
|
|
'res.partner.category', 'read', array($ids)
|
|
);
|
|
|
|
|
|
foreach ($tags as $key => $tag) {
|
|
$tag['display_name'] = trim($tag['display_name']);
|
|
|
|
$sql = 'SELECT * FROM '._DB_PREFIX_.'group_lang WHERE id_lang = 1 AND name = "'.$tag['display_name'].'"';
|
|
$exist = (bool)Db::getInstance()->getRow($sql);
|
|
|
|
$a = date("Y-m-d H:i:s");
|
|
|
|
if (!$exist && !empty($tag['display_name'])) {
|
|
$id = Db::getInstance()->autoExecute(_DB_PREFIX_.'group', array(
|
|
'reduction' => 0,
|
|
'price_display_method' => 1,
|
|
'show_prices' => 1,
|
|
'date_add' => $a,
|
|
'date_upd' => $a
|
|
), 'INSERT');
|
|
|
|
$id = Db::getInstance()->Insert_ID();
|
|
|
|
$done = Db::getInstance()->autoExecute(_DB_PREFIX_.'group_lang', array(
|
|
'id_group' => (int)$id,
|
|
'id_lang' => 1,
|
|
'name' => pSQL($tag['display_name'])
|
|
), 'INSERT');
|
|
|
|
}
|
|
}
|
|
|
|
?>
|