? Success

User tests: Successful: Unsuccessful:

avatar jackkum
jackkum
25 Dec 2014

In my project, users are synchronized with the accounting program.
User and the contact is created from a cli script

// We are a valid entry point.
const _JEXEC = 1;

error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', 1);

// Load system defines
if (file_exists(dirname(DIR) . '/defines.php'))
{
require_once dirname(DIR) . '/defines.php';
}

if (!defined('JDEFINES'))
{
define('JPATH_BASE', dirname(__DIR_));
require_once JPATH_BASE . '/includes/defines.php';
}

require_once JPATH_CONFIGURATION . '/configuration.php';

require_once JPATH_LIBRARIES . '/import.legacy.php';
require_once JPATH_LIBRARIES . '/cms.php';

$config = new JConfig;

error_reporting(E_ALL);
ini_set('display_errors', 1);

// im doing something wrong, without this have warnings
$_SERVER['HTTP_HOST'] = 'example.com';
$_SERVER['REQUEST_URI'] = NULL;

// init session
JFactory::getSession();
// admin app
JFactory::getApplication('administrator');

class JContactAddCli extends JApplicationCli
{
public function doExecute()
{
jimport('joomla.user.helper');
$user_id = $this->input->getInt('user');
$catid = $this->input->getInt('catid', 0);

   if( ! $user_id){
       $this->out("Input user", TRUE);
       return FALSE;
   }
   // ...
   $contactsModel = FOFModel::getAnInstance('Contacts', 'ContactModel');
   $contactsModel->setState('filter.user_id', $user_id);
   $contactsModel->getItems();
   // ...
}

}

// added filter in method ContactModelContacts::getListQuery
if (($user_id = $this->getState('filter.user_id')))
{
$query->where('a.user_id = ' . (int) $user_id);
}

Sorry, have some troubles with git.
Remove spaces from empty line

avatar jackkum jackkum - open - 25 Dec 2014
avatar jissues-bot jissues-bot - change - 25 Dec 2014
Labels Added: ?
avatar jackkum
jackkum - comment - 3 Jan 2015

Found user plugin 'contactcreator'.
Sorry to trouble

avatar jackkum jackkum - close - 3 Jan 2015
avatar jackkum jackkum - change - 3 Jan 2015
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-01-03 15:50:29

Add a Comment

Login with GitHub to post a comment