示例#1
0
    private function _displayInformations()
    {
        $html = '';
        /* Get configuration */
        $urlws = Configuration::get('OSI_WS_URL');
        $portws = Configuration::get('OSI_WS_PORT');
        $loginws = Configuration::get('OSI_WS_LOGIN');
        $passwdws = Configuration::get('OSI_WS_PASSWD');
        $servicecode = Configuration::get('OSI_SERVICE_CODE');
        $websitecode = Configuration::get('OSI_WEBSITE_CODE');
        $depotcode = Configuration::get('OSI_DEPOSIT_CODE');
        if ($urlws == '' || $portws == '' || $loginws == '' || $passwdws == '' || $servicecode == '' || $websitecode == '' || $depotcode == '') {
            $html .= '<div class="error_box">' . $this->l('The webservice access OpenSi and the cron must be configured.');
            $html .= '<br />';
            $html .= $this->l('Absolute path to specify in your crontab') . ' : sh ' . dirname(__FILE__) . '/cron.sh</div>';
        }
        $html .= '
			<fieldset>
				<legend><img src="' . $this->_path . 'img/access.png" alt="" />' . $this->l('Access configuration') . '</legend>
				<label>' . $this->l('Login') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" name="osi_ws_login" class="biginp" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getWsLogin()) . '" />
				</div>	
				<label>' . $this->l('Password') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="password" name="osi_ws_passwd" class="biginp" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getWsPasswd()) . '" />
				</div>
				<label>' . $this->l('Service code') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" name="osi_service_code" class="biginp" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getServiceCode()) . '" />
				</div>
				<label>' . $this->l('website code') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" name="osi_website_code" class="biginp" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getWebSiteCode()) . '" />
				</div>
				<label>' . $this->l('deposit code') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" name="osi_deposit_code" class="biginp" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getDepositCode()) . '" />
				</div>																		
			</fieldset>

			<br /><br />

			<fieldset>
				<legend><img src="' . $this->_path . 'img/cron.png" alt="" />' . $this->l('Cron configuration') . '</legend>
				<strong>D&eacute;finition</strong> : Le cron est un s&eacute;quenceur de t&acirc;ches syst&egrave;me UNIX.<br />
				<u>Son activation est n&eacute;cessaire</u> pour automatiser les flux (commandes, clients, stocks, prix, ...) entre OpenSi et votre boutique.<br />
				Pour installer le cron, vous devez proc&eacute;der de la mani&egrave;re suivante :<br /><br />

				<strong>1. Connection &agrave; votre serveur en SSH</strong>
				<div class="cron-details">
					Pour se connecter, ouvrir un terminal et taper la ligne de commande suivante :<br />
					<span class="courier">ssh user@host</span><br />
					<i class="courier">Ex : ssh martin@120.01.02.03</i><br />
					Appuyer sur la touche "entr&eacute;e".<br />
					Rentrer le mot de passe et appuyer &agrave; nouveau sur la touche "entr&eacute;e".<br />
					Vous devez maintenant &ecirc;tre connect&eacute; &agrave; votre serveur.<br /><br />
					<span class="grey">&rarr; L\'&eacute;diteur OpenSi reste &agrave; votre disposition pour vous assister dans <a href="http://www.opensi.fr/Contact_Prestashop.html" class="grey" target="_blank">la mise en place de ce cron</a>.</span>
				</div>

				<strong>2. &Eacute;dition de la crontab</strong>
				<div class="cron-details">
					Pour &eacute;diter la crontab, taper la ligne de commande suivante :<br />
					<span class="courier">crontab -e</span><br />
					et appuyer sur la touche "entr&eacute;e".
				</div>

				<strong>3. Configuration de la crontab</strong>
				<div class="cron-details">
					Ajouter la ligne suivante dans votre crontab, enregistrer et fermer le fichier.<br />
					<span class="courier">*/10 * * * * sh ' . dirname(__FILE__) . '/cron.sh</span>
				</div>

				Votre crontab est maintenant configur&eacute;e.
			</fieldset>

			<br /><br />

			<fieldset>
				<legend><img src="' . $this->_path . 'img/parameters.png" alt="" />' . $this->l('OpenSi adminnistration') . '</legend>
				<span class="mini brown"><img src="' . $this->_path . 'img/warning.png" alt="" />' . $this->l('Do not change the value of the fields below.') . '</span><br /><br />
				<label>' . $this->l('Url') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" name="osi_ws_url" class="biginp" id="ws_url" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getWsUrl()) . '" />
				</div>
				<label>' . $this->l('Port') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" name="osi_ws_port" class="biginp" value="' . Tools::htmlentitiesUTF8(GlobalConfig::getWsPort()) . '" />
				</div>
			</fieldset>
		';
        return $html;
    }
 *
 * @author Speedinfo SARL
 * @copyright 2003-2012 Speedinfo SARL
 * @contact contact@speedinfo.fr
 * @url http://www.speedinfo.fr
 *
 */
/* Loading classes */
if (file_exists(dirname(__FILE__) . '/dao.class.php')) {
    include_once 'dao.class.php';
}
if (file_exists(dirname(__FILE__) . '/postActionRequest.class.php')) {
    include_once 'postActionRequest.class.php';
}
$dao = new Dao();
$postOSIReq = new PostActionRequests(GlobalConfig::getWsUrl(), GlobalConfig::getWsPort(), 20, GlobalConfig::getWsLogin(), GlobalConfig::getWsPasswd(), GlobalConfig::getServiceCode(), GlobalConfig::getWebSiteCode());
/* WebService infos values */
$wSOInfosList = Scheduler::getWsInfosList();
/* POST requests */
if (ForceRequest::isForcedRequest()) {
    /* Send only one POST request */
    $wsName = ForceRequest::getWsName();
    $dateFrom = ForceRequest::getDateFrom() . " " . ForceRequest::getTimeFrom();
    $dateFrom = date::dateTimeFr2DateTimeBdd($dateFrom);
    $dateTo = ForceRequest::getDateTo() . " " . ForceRequest::getTimeTo();
    $dateTo = date::dateTimeFr2DateTimeBdd($dateTo);
    doPostSynch($wsName, $dateFrom, $dateTo);
} else {
    /* Send all POST requests in function of the scheduler permissions */
    $wSOList = Scheduler::getWsNamePostList();
    foreach ($wSOList as $wsName) {