function doActions($parameters, &$object, &$action, $hookmanager)
 {
     if (GETPOST('addcontratline')) {
         $fk_line_contrat_origin = GETPOST('fk_line_contrat_origin', 'int');
         if ($fk_line_contrat_origin > 0) {
             global $db;
             dol_include_once('/contrat/class/contrat.class.php');
             $lineContrat = new ContratLigne($db);
             $res = $lineContrat->fetch($fk_line_contrat_origin);
             if ($res > 0) {
                 $linePropal = new PropaleLigne($db);
                 $array_options = array();
                 require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
                 $extrafields = new ExtraFields($db);
                 $TExtra = $extrafields->fetch_name_optionals_label($linePropal->table_element);
                 // Récupération des extrafields de la ligne contrat vers la ligne propal
                 $lineContrat->fetch_optionals();
                 foreach ($lineContrat->array_options as $key => $val) {
                     $subkey = substr($key, 8);
                     if (isset($TExtra[$subkey])) {
                         $array_options[$key] = $val;
                     }
                 }
                 if (isset($TExtra['fk_contratdet_origin'])) {
                     $array_options['options_fk_contratdet_origin'] = $lineContrat->id;
                 }
                 $object->addline($lineContrat->description, $lineContrat->subprice, $lineContrat->qty, $lineContrat->tva_tx, $lineContrat->localtax1_tx, $lineContrat->localtax2_tx, $lineContrat->fk_product, $lineContrat->remise_percent, 'HT', 0.0, $lineContrat->info_bits, 1, -1, 0, 0, 0, $lineContrat->pa_ht, '', $lineContrat->date_ouverture_prevue, $lineContrat->date_fin_validite, $array_options, $lineContrat->fk_unit);
             }
         }
     }
 }
function _action()
{
    global $user, $db, $conf, $langs;
    $action = GETPOST('action', 'alpha');
    switch ($action) {
        case 'import':
            ini_set("auto_detect_line_endings", true);
            $TPayment = _parseFile($conf);
            _printHeader($langs, $user);
            _printFormFile($user, $db, $conf, $langs);
            _printFormConfirm($user, $db, $conf, $langs, $TPayment);
            _printFooter();
            break;
        case 'import_confirm':
            _setPayment($user, $db, $conf, $langs);
            header('Location: ' . dol_buildpath('/paymentimport/card.php', 2));
            exit;
            break;
        default:
            _printHeader($langs, $user);
            _printFormFile($user, $db, $conf, $langs);
            _printErrorFromImportConfirm();
            _printFooter();
            break;
    }
}
Example #3
0
 /**
  *	Constructor
  *
  *	@param	DoliDB		$db				Database handler
  *	@param	string		$datatoimport	String code describing import set (ex: 'societe_1')
  */
 function __construct($db, $datatoimport)
 {
     global $conf, $langs;
     $this->db = $db;
     $this->separator = GETPOST('separator') ? GETPOST('separator') : (empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE);
     $this->enclosure = '"';
     $this->escape = '"';
     $this->id = 'csv';
     // Same value then xxx in file name export_xxx.modules.php
     $this->label = 'Csv';
     // Label of driver
     $this->desc = $langs->trans("CSVFormatDesc", $this->separator, $this->enclosure, $this->escape);
     $this->extension = 'csv';
     // Extension for generated file by this driver
     $this->picto = 'mime/other';
     // Picto
     $this->version = '1.34';
     // Driver version
     // If driver use an external library, put its name here
     $this->label_lib = 'Dolibarr';
     $this->version_lib = DOL_VERSION;
     $this->datatoimport = $datatoimport;
     if (preg_match('/^societe_/', $datatoimport)) {
         $this->thirpartyobject = new Societe($this->db);
     }
 }
    /** Overloading the doActions function : replacing the parent's function with the one below 
     *  @param      parameters  meta datas of the hook (context, etc...) 
     *  @param      object             the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 
     *  @param      action             current action (if set). Generally create or edit or null 
     *  @return       void 
     */
    function formObjectOptions($parameters, &$object, &$action, $hookmanager)
    {
        global $langs, $db;
        define('INC_FROM_DOLIBARR', true);
        dol_include_once("/propalehistory/config.php");
        dol_include_once("/comm/propal/class/propal.class.php");
        if (in_array('propalcard', explode(':', $parameters['context']))) {
            if ($action != 'create' && $action != 'statut' && $action != 'presend') {
                dol_include_once("/propalehistory/class/propaleHist.class.php");
                $ATMdb = new TPDOdb();
                $actionATM = GETPOST('actionATM');
                if ($actionATM == 'viewVersion') {
                    ?>
						<script type="text/javascript">
							$(document).ready(function() {
								$('div.tabsAction').html('<?php 
                    echo '<div><a id="returnCurrent" href="' . $_SERVER['PHP_SELF'] . '?id=' . $_REQUEST['id'] . '">Retour version courante</a> <a id="butRestaurer" class="butAction" href="' . DOL_URL_ROOT . '/comm/propal.php?id=' . $_REQUEST['id'] . '&actionATM=restaurer&idVersion=' . $_REQUEST['idVersion'] . '">Restaurer</a><a id="butSupprimer" class="butAction" href="' . DOL_URL_ROOT . '/comm/propal.php?id=' . $_REQUEST['id'] . '&actionATM=supprimer&idVersion=' . $_REQUEST['idVersion'] . '">Supprimer</a></div>';
                    ?>
');
								$('#butRestaurer').insertAfter('#voir');
								$('#butSupprimer').insertBefore('#voir');
								$('#builddoc_form').hide();
							})
						</script>
					
					<?php 
                    TPropaleHist::listeVersions($db, $object);
                } elseif ($actionATM == 'createVersion') {
                    TPropaleHist::listeVersions($db, $object);
                } elseif ($actionATM == '' && $object->statut == 1) {
                    print '<a id="butNewVersion" class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $_REQUEST['id'] . '&actionATM=createVersion">Archiver</a>';
                    ?>
						<script type="text/javascript">
							$(document).ready(function() {
								$("#butNewVersion").appendTo('div.tabsAction');
							})
						</script>
					<?php 
                    $num = TPropaleHist::listeVersions($db, $object);
                } else {
                    $num = TPropaleHist::listeVersions($db, $object);
                }
                if (!empty($num)) {
                    ?>
						<script type="text/javascript">
							$("a#comm").first().append(" / v. <?php 
                    echo $num + 1;
                    ?>
");
						console.log($("a#comm").first());
						</script>
					<?php 
                }
            }
        }
        return 0;
    }
Example #5
0
/**
 * Check validity of user/password/entity
 * If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
 *
 * @param	string	$usertotest		Login
 * @param	string	$passwordtotest	Password
 * @param   int		$entitytotest   Number of instance (always 1 if module multicompany not enabled)
 * @return	string					Login if OK, '' if KO
 */
function check_user_password_otp($usertotest, $passwordtotest, $entitytotest)
{
    global $db, $conf, $dolibarr_main_cookie_cryptkey;
    dol_include_once('/core/login/functions_dolibarr.php');
    //We first check if user & password are OK
    if (check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotest) == '') {
        return '';
    }
    // Force master entity in transversal mode
    $entity = $entitytotest;
    if (!empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode)) {
        $entity = 1;
    }
    $sql = 'SELECT rowid, otp_seed, otp_counter';
    $sql .= ' FROM ' . MAIN_DB_PREFIX . "user";
    $sql .= ' WHERE login = "******"';
    $sql .= ' AND entity IN (0,' . ($entity ? $entity : 1) . ")";
    dol_syslog("functions_dolibarr::check_user_password_dolibarr sql=" . $sql);
    $resql = $db->query($sql);
    if ($resql) {
        $obj = $db->fetch_object($resql);
        if ($obj) {
            //The user has not configured an OTP key
            if (!$obj->otp_seed) {
                return $usertotest;
            }
            //Now we validate OTP
            $providedOTP = GETPOST('otp');
            if (empty($providedOTP)) {
                return '';
            }
            /**
             * Examples from http://es.php.net/mcrypt_encrypt
             */
            $ciphertext_dec = base64_decode($obj->otp_seed);
            $key = pack('H*', $dolibarr_main_cookie_cryptkey);
            # recupera la IV, iv_size debería crearse usando mcrypt_get_iv_size()
            $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
            $iv_dec = substr($ciphertext_dec, 0, $iv_size);
            # recupera el texto cifrado (todo excepto el $iv_size en el frente)
            $ciphertext_dec = substr($ciphertext_dec, $iv_size);
            # podrían eliminarse los caracteres con valor 00h del final del texto puro
            $otpSeed = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec);
            $otplib = new \Rych\OTP\HOTP($otpSeed);
            if ($otplib->validate($providedOTP, $obj->otp_counter)) {
                $obj->otp_counter++;
                $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET otp_counter = '" . $obj->otp_counter . "' WHERE rowid = " . $obj->rowid;
                $db->query($sql);
                // Now the user is authenticated
                return $usertotest;
            }
        }
    }
    return '';
}
    public function formObjectOptions($parameters, &$object, &$action, HookManager $hookManager)
    {
        global $db, $user, $langs, $mysoc, $dolibarr_main_cookie_cryptkey;
        $langs->load('otp@otp');
        $regenerate_button = '<form method="post">
			<input type="submit" value="' . $langs->trans('OTPRegenerate') . '" class="button" name="regenerate_otp">
		</form>';
        if ($action == '') {
            print '<tr><td>' . $langs->trans('OTPLogin') . '</td><td colspan="2">';
            if (GETPOST('regenerate_otp')) {
                if ($user->admin || $user->id == GETPOST('id', 'int')) {
                    /**
                     * Examples from http://es.php.net/mcrypt_encrypt
                     */
                    // Generates a 20-byte (160-bit) secret key
                    $otpSeed = Seed::generate();
                    $base32Seed = $otpSeed->getValue(Seed::FORMAT_BASE32);
                    $key = pack('H*', $dolibarr_main_cookie_cryptkey);
                    # crear una aleatoria IV para utilizarla co condificación CBC
                    $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
                    $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
                    $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $base32Seed, MCRYPT_MODE_CBC, $iv);
                    # anteponer la IV para que esté disponible para el descifrado
                    $ciphertext = $iv . $ciphertext;
                    # codificar el texto cifrado resultante para que pueda ser representado por un string
                    $ciphertext_base64 = base64_encode($ciphertext);
                    $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET otp_seed = '" . $db->escape($ciphertext_base64) . "', otp_counter = 0 WHERE rowid = " . $user->id;
                    $db->query($sql);
                    $qrCode = new QrCode();
                    $qrCode->setText("otpauth://hotp/" . $mysoc->name . ":" . $user->login . "?secret=" . $base32Seed . "&issuer=" . $mysoc->name);
                    $qrCode->setSize(96);
                    $qrCode->setPadding(5);
                    $img_path = __DIR__ . '/../tmp/' . $user->id . '.png';
                    $qrCode->save($img_path);
                    //Qrcode library doesn't warn on image creation error
                    if (file_exists($img_path)) {
                        print '<img src="' . dol_buildpath('/otp/showdoc.php', 1) . '?img=' . $user->id . '"><br>' . $langs->trans('OTPTroubleHash') . '<br />
				<span style="font-family:monospace;font-size:20px">' . $base32Seed . '</span><br>' . $langs->trans('OTPKeyType');
                    } else {
                        print $regenerate_button;
                        setEventMessage('ErrorCreatingImage', 'errors');
                    }
                }
            } else {
                if ($user->admin || $user->id == GETPOST('id', 'int')) {
                    print $regenerate_button;
                }
            }
            print '</td></tr>';
        }
    }
function _put($put)
{
    $PDOdb = new TPDOdb();
    switch ($put) {
        case 'view':
            $ps = new TPersonnalView();
            $ps->loadByElementAction($PDOdb, GETPOST('element'), GETPOST('action'));
            $ps->element = GETPOST('element');
            $ps->action = GETPOST('action');
            $ps->TField = GETPOST('TField', 'array');
            echo $ps->save($PDOdb);
            break;
    }
}
function _get(&$PDOdb, $get)
{
    switch ($get) {
        case 'serial_number':
            __out(_serial_number($PDOdb, GETPOST('term')), 'json');
            break;
        case 'autocomplete_asset':
            __out(_autocomplete_asset($PDOdb, GETPOST('lot_number'), GETPOST('productid')), 'json');
            break;
        case 'autocomplete_lot_number':
            __out(_autocomplete_lot_number($PDOdb, GETPOST('productid')), 'json');
            break;
    }
}
 /**
  * Overloading the doActions function : replacing the parent's function with the one below
  *
  * @param   array()         $parameters     Hook metadatas (context, etc...)
  * @param   CommonObject    &$object        The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
  * @param   string          &$action        Current action (if set). Generally create or edit or null
  * @param   HookManager     $hookmanager    Hook manager propagated to allow calling another hook
  * @return  int                             < 0 on error, 0 on success, 1 to replace standard code
  */
 function doActions($parameters, &$object, &$action, $hookmanager)
 {
     global $user, $conf, $langs, $db;
     if ($parameters['currentcontext'] == 'ordersuppliercard' && !empty($conf->fournisseur->enabled) && $object->statut >= 2 && $action == 'billedreception') {
         if ($user->rights->fournisseur->facture->creer) {
             $datereception = GETPOST('datereception');
             if (!empty($datereception)) {
                 $resultset = $db->query("SELECT fk_commandefourndet,fk_product,SUM(qty) as qty\n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch \n\t\t\t\t\tWHERE fk_commande=" . $object->id . "\n\t\t\t\t\tAND datec LIKE '" . date('Y-m-d H', strtotime($datereception)) . "%'\n\t\t\t\t\tGROUP BY fk_commandefourndet,fk_product\n\t\t\t\t\t");
                 $Tab = array();
                 while ($obj = $db->fetch_object($resultset)) {
                     $obj->line = $this->getGoodLine($object, $obj->fk_commandefourndet, $obj->fk_product);
                     $Tab[] = $obj;
                 }
                 $this->createFacture($object, $Tab);
             }
         }
     }
 }
function _priceUpdateDolibarr(&$db, &$conf, &$langs)
{
    dol_include_once('/product/class/product.class.php');
    $error = 0;
    $fk_category = GETPOST('fk_category', 'int');
    $tms = dol_mktime(GETPOST('tmshour', 'int'), GETPOST('tmsmin', 'int'), 0, GETPOST('tmsmonth', 'int'), GETPOST('tmsday', 'int'), GETPOST('tmsyear', 'int'));
    $percentage = (double) GETPOST('percentage');
    if ($fk_category <= -1) {
        setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('quickpriceupdate_category_required')), null, 'errors');
        $error++;
    }
    if ($tms == '') {
        setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('quickpriceupdate_date_required')), null, 'errors');
        $error++;
    }
    if (!$error && $percentage != 0) {
        $tms = date('Y-m-d H:i:00', $tms);
        _priceUpdateDolibarrAction($db, $conf, $langs, $fk_category, $tms, $percentage);
    }
}
 function doActions($parameters, &$object, &$action)
 {
     global $langs, $user;
     $langs->load('resource@resource');
     if (in_array('element_resource', explode(':', $parameters['context']))) {
         // Efface une ressource
         if ($action == 'confirm_delete_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes') {
             $res = $object->fetch(GETPOST('lineid'));
             if ($res) {
                 $result = $object->delete_resource(GETPOST('lineid'), GETPOST('element'));
                 if ($result >= 0) {
                     setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
                     Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . GETPOST('element') . "&element_id=" . GETPOST('element_id'));
                     exit;
                 } else {
                     setEventMessage($object->error, 'errors');
                 }
             }
         }
         // Update ressource
         if ($action == 'update_resource' && $user->rights->resource->write && !GETPOST('cancel')) {
             $res = $object->fetch(GETPOST('lineid'));
             if ($res) {
                 $object->id = GETPOST('lineid');
                 $object->busy = GETPOST('busy');
                 $object->mandatory = GETPOST('mandatory');
                 $result = $object->update();
                 if ($result >= 0) {
                     setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated'));
                     Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . GETPOST('element') . "&element_id=" . GETPOST('element_id'));
                     exit;
                 } else {
                     setEventMessage($object->error, 'errors');
                 }
             }
         }
     }
 }
Example #12
0
/**
 *  Define head array for tabs of printing tools setup pages
 *
 *  @param	string	$mode		Mode
 *  @return         			Array of head
 */
function printingadmin_prepare_head($mode)
{
    global $langs, $conf;
    $h = 0;
    $head = array();
    $head[$h][0] = DOL_URL_ROOT . "/printing/admin/printing.php?mode=config";
    $head[$h][1] = $langs->trans("ListDrivers");
    $head[$h][2] = 'config';
    $h++;
    if ($mode == 'setup') {
        $head[$h][0] = DOL_URL_ROOT . "/printing/admin/printing.php?mode=setup&driver=" . GETPOST('driver', 'alpha');
        $head[$h][1] = $langs->trans("SetupDriver");
        $head[$h][2] = 'setup';
        $h++;
    }
    if ($mode == 'test') {
        $head[$h][0] = DOL_URL_ROOT . "/printing/admin/printing.php?mode=test&driver=" . GETPOST('driver', 'alpha');
        $head[$h][1] = $langs->trans("TargetedPrinter");
        $head[$h][2] = 'test';
        $h++;
    }
    /** TODO This feature seem to be not ready yet.
        $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf";
        $head[$h][1] = $langs->trans("UserConf");
        $head[$h][2] = 'userconf';
        $h++;
        */
    //$object=new stdClass();
    // Show more tabs from modules
    // Entries must be declared in modules descriptor with line
    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
    // $this->tabs = array('entity:-tabname);                                                   to remove a tab
    //complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
    //complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
    return $head;
}
Example #13
0
 /**
  * return array_options array for object by extrafields value (using for data send by forms)
  *
  * @param  array   $extralabels    $array of extrafields
  * @param  string  $keyprefix      Prefix string to add into name and id of field (can be used to avoid duplicate names)
  * @param  string  $keysuffix      Suffix string to add into name and id of field (can be used to avoid duplicate names)
  * @return int                     1 if array_options set / 0 if no value
  */
 function getOptionalsFromPost($extralabels, $keyprefix = '', $keysuffix = '')
 {
     global $_POST;
     $array_options = array();
     if (is_array($extralabels)) {
         // Get extra fields
         foreach ($extralabels as $key => $value) {
             $key_type = $this->attribute_type[$key];
             if (in_array($key_type, array('date', 'datetime'))) {
                 // Clean parameters
                 $value_key = dol_mktime($_POST[$keysuffix . "options_" . $key . $keyprefix . "hour"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "min"], 0, $_POST[$keysuffix . "options_" . $key . $keyprefix . "month"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "day"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "year"]);
             } else {
                 if (in_array($key_type, array('checkbox'))) {
                     $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix);
                     // Make sure we get an array even if there's only one checkbox
                     $value_arr = (array) $value_arr;
                     $value_key = implode(',', $value_arr);
                 } else {
                     if (in_array($key_type, array('price', 'double'))) {
                         $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix);
                         $value_key = price2num($value_arr);
                     } else {
                         $value_key = GETPOST($keysuffix . "options_" . $key . $keyprefix);
                     }
                 }
             }
             $array_options[$keysuffix . "options_" . $key] = $value_key;
             // No keyprefix here. keyprefix is used only for read.
         }
         return $array_options;
     } else {
         return 0;
     }
 }
Example #14
0
 *      \file       htdocs/categories/index.php
 *      \ingroup    category
 *      \brief      Home page of category area
 */
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/treeview.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$langs->load("categories");
if (!$user->rights->categorie->lire) {
    accessforbidden();
}
$id = GETPOST('id', 'int');
$type = GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT;
$catname = GETPOST('catname', 'alpha');
$section = GETPOST('section') ? GETPOST('section') : 0;
/*
 * View
 */
$categstatic = new Categorie($db);
$form = new Form($db);
if ($type == Categorie::TYPE_PRODUCT) {
    $title = $langs->trans("ProductsCategoriesArea");
} elseif ($type == Categorie::TYPE_SUPPLIER) {
    $title = $langs->trans("SuppliersCategoriesArea");
} elseif ($type == Categorie::TYPE_CUSTOMER) {
    $title = $langs->trans("CustomersCategoriesArea");
} elseif ($type == Categorie::TYPE_MEMBER) {
    $title = $langs->trans("MembersCategoriesArea");
} elseif ($type == Categorie::TYPE_CONTACT) {
    $title = $langs->trans("ContactsCategoriesArea");
Example #15
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
/**
 *   \file       htdocs/societe/note.php
 *   \brief      Tab for notes on third party
 *   \ingroup    societe
 */
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$action = GETPOST('action');
$langs->load("companies");
// Security check
$id = GETPOST('id') ? GETPOST('id', 'int') : GETPOST('socid', 'int');
if ($user->societe_id) {
    $id = $user->societe_id;
}
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
if ($id > 0) {
    $object->fetch($id);
}
$permissionnote = $user->rights->societe->creer;
// Used by the include of actions_setnotes.inc.php
/*
 * Actions
 */
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not includ_once
                        // No alpha here, we want exact string
                        $res = dolibarr_set_const($db, "COMMANDE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
                        if (!$res > 0) {
                            $error++;
                        }
                        if (!$error) {
                            setEventMessage($langs->trans("SetupSaved"));
                        } else {
                            setEventMessage($langs->trans("Error"), 'errors');
                        }
                    } else {
                        if ($action == 'setModuleOptions') {
                            if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH", GETPOST('value1'), 'chaine', 0, '', $conf->entity)) {
                                // La constante qui a ete lue en avant du nouveau set
                                // on passe donc par une variable pour avoir un affichage coherent
                                $conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1');
                            }
                        }
                    }
                }
            }
        }
    }
}
/*
 * View
 */
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", $langs->trans("OrdersSetup"));
$form = new Form($db);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
Example #17
0
    echo ' ' . $line->ref;
    ?>
		</a>
		<?php 
    echo ' - ' . nl2br($line->product_label);
    ?>

		<br>

	<?php 
}
?>

	<?php 
if (is_object($hookmanager)) {
    $fk_parent_line = GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line;
    $parameters = array('line' => $line, 'fk_parent_line' => $fk_parent_line, 'var' => $var, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer);
    $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
}
// Do not allow editing during a situation cycle
if (empty($this->situation_cycle_ref) || $this->situation_counter == 1) {
    // editeur wysiwyg
    require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
    $nbrows = ROWS_2;
    if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
        $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
    }
    $enable = isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0;
    $toolbarname = 'dolibarr_details';
    if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) {
        $toolbarname = 'dolibarr_notes';
     print '</div>';
 }
 /*
  * Correct stock
  */
 if ($action == "correction") {
     print_titre($langs->trans("StockCorrection"));
     print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
     print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     print '<input type="hidden" name="action" value="correct_stock">';
     print '<table class="border" width="100%">';
     // Warehouse
     print '<tr>';
     print '<td width="20%">' . $langs->trans("Product") . '</td>';
     print '<td width="20%">';
     print $form->select_produits(GETPOST('productid'), 'product_id', empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : '');
     print '</td>';
     print '<td width="20%">';
     print '<select name="mouvement" class="flat">';
     print '<option value="0">' . $langs->trans("Add") . '</option>';
     print '<option value="1">' . $langs->trans("Delete") . '</option>';
     print '</select></td>';
     print '<td width="20%">' . $langs->trans("NumberOfUnit") . '</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
     print '</tr>';
     // Label
     print '<tr>';
     print '<td width="20%">' . $langs->trans("Label") . '</td>';
     print '<td colspan="4">';
     print '<input type="text" name="label" size="40" value="">';
     print '</td>';
     print '</tr>';
Example #19
0
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
/**
 *   \file       htdocs/loan/note.php
 *   \brief      Tab for notes on loan
 *   \ingroup    loan
 */
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/loan.lib.php';
$action = GETPOST('action');
$langs->load('loan');
// Security check
$id = GETPOST('id', 'int');
$result = restrictedArea($user, 'loan', $id, '&loan');
$object = new Loan($db);
if ($id > 0) {
    $object->fetch($id);
}
$permissionnote = $user->rights->loan->write;
// Used by the include of actions_setnotes.inc.php
/*
 *  Actions
 */
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not include_once
/*
 *  View
 */
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("widthdrawals");
// Security check
$socid = GETPOST('socid', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
// Get supervariables
$page = GETPOST('page', 'int');
$sortorder = GETPOST('sortorder', 'alpha') == "" ? "DESC" : GETPOST('sortorder', 'alpha');
$sortfield = GETPOST('sortfield', 'alpha') == "" ? "p.datec" : GETPOST('sortfield', 'alpha');
$statut = GETPOST('statut', 'int');
$search_line = GETPOST('search_ligne', 'int');
llxHeader('', $langs->trans("WithdrawalsReceipts"));
$bon = new BonPrelevement($db, "");
if ($page == -1) {
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
 * Mode Liste
 *
 */
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
$sql .= ", p.datec";
$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
Example #21
0
require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
$langs->load("projects");
$langs->load("companies");
$mine = GETPOST('mode') == 'mine' ? 1 : 0;
// Security check
$socid = 0;
if ($user->societe_id > 0) {
    $socid = $user->societe_id;
}
if (!$user->rights->projet->lire) {
    accessforbidden();
}
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
/*
 * View
 */
$socstatic = new Societe($db);
$projectstatic = new Project($db);
$userstatic = new User($db);
$tasktmp = new Task($db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine ? $mine : (empty($user->rights->projet->all->lire) ? 0 : 2), 1);
//var_dump($projectsListId);
llxHeader("", $langs->trans("Projects"), "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos");
$text = $langs->trans("Projects");
if ($mine) {
    $text = $langs->trans("MyProjects");
}
print_fiche_titre($text);
Example #22
0
    $modetax = 0;
}
// Security check
$socid = GETPOST('socid', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'tax', '', '', 'charges');
/*
 * View
 */
$morequerystring = '';
$listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday');
foreach ($listofparams as $param) {
    if (GETPOST($param) != '') {
        $morequerystring .= ($morequerystring ? '&' : '') . $param . '=' . GETPOST($param);
    }
}
llxHeader('', '', '', '', 0, 0, '', '', $morequerystring);
$form = new Form($db);
$company_static = new Societe($db);
$invoice_customer = new Facture($db);
$invoice_supplier = new FactureFournisseur($db);
$product_static = new Product($db);
$payment_static = new Paiement($db);
$paymentfourn_static = new PaiementFourn($db);
//print load_fiche_titre($langs->trans("VAT"),"");
//$fsearch.='<br>';
$fsearch .= '  <input type="hidden" name="year" value="' . $year . '">';
$fsearch .= '  <input type="hidden" name="modetax" value="' . $modetax . '">';
//$fsearch.='  '.$langs->trans("SalesTurnoverMinimum").': ';
Example #23
0
    }
    .topmenuimage {
    	background-size: 20px auto;
    	margin-top: 2px;
	}
}
/* rule to reduce top menu - 3rd reduction */
@media only screen and (max-width: 570px)
{
	/* Reduce login top right info */
	.usertextatoplogin {
		display: none;
	}
	div#tmenu_tooltip {
	<?php 
if (GETPOST("optioncss") == 'print') {
    ?>
		display:none;
	<?php 
} else {
    ?>
		padding-<?php 
    echo $right;
    ?>
: 78px;
	<?php 
}
?>
	}
	div.login_block {
		top: 4px;
Example #24
0
     exit;
 }
 $helpurl = '';
 if (isset($type)) {
     if ($type == 0) {
         $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
     } else {
         if ($type == 1) {
             $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
         }
     }
 }
 llxHeader('', $title, $helpurl, '');
 // Displays product removal confirmation
 if (GETPOST('delprod')) {
     setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
 }
 if ($search_categ > 0) {
     $param .= "&amp;search_categ=" . $search_categ;
 }
 if ($sref) {
     $param = "&amp;sref=" . $sref;
 }
 if ($search_ref_supplier) {
     $param = "&amp;search_ref_supplier=" . $search_ref_supplier;
 }
 if ($sbarcode) {
     $param .= $sbarcode ? "&amp;sbarcode=" . $sbarcode : "";
 }
 if ($snom) {
     $param .= "&amp;snom=" . $snom;
    print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
    if ($user->admin) {
        print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
    }
    print '</td></tr>';
    print '<tr><td>' . $langs->trans("Status") . '</td><td colspan="3">';
    print '<select name="statut" class="flat">';
    print '<option value="0">' . $langs->trans("WarehouseClosed") . '</option>';
    print '<option value="1" selected="selected">' . $langs->trans("WarehouseOpened") . '</option>';
    print '</select>';
    print '</td></tr>';
    print '</table>';
    print '<center><br><input type="submit" class="button" value="' . $langs->trans("Create") . '"></center>';
    print '</form>';
} else {
    $id = GETPOST("id", 'int');
    if ($id) {
        dol_htmloutput_mesg($mesg);
        $object = new Entrepot($db);
        $result = $object->fetch($id);
        if ($result < 0) {
            dol_print_error($db);
        }
        /*
         * Affichage fiche
         */
        if ($action != 'edit' && $action != 're-edit') {
            $head = stock_prepare_head($object);
            dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
            // Confirm delete third party
            if ($action == 'delete') {
Example #26
0
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
/**
 *	\file       htdocs/comm/propal/index.php
 *	\ingroup    propal
 *	\brief      Home page of proposal area
 */
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
$langs->load("supplier_proposal");
$langs->load("companies");
// Security check
$socid = GETPOST('socid', 'int');
if (isset($user->societe_id) && $user->societe_id > 0) {
    $action = '';
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'supplier_proposal');
/*
 * View
 */
$now = dol_now();
$supplier_proposalstatic = new SupplierProposal($db);
$companystatic = new Societe($db);
$form = new Form($db);
$formfile = new FormFile($db);
$help_url = "EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur";
llxHeader("", $langs->trans("SupplierProposalArea"), $help_url);
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * or see http://www.gnu.org/
 */
/**
 *	\file			htdocs/core/actions_sendmails.inc.php
 *  \brief			Code for actions on sending mails from object page
 */
// TODO Include this include file into all class objects
// $id must be defined
// $actiontypecode must be defined
/*
 * Add file in email form
 */
if (GETPOST('addfile')) {
    require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
    // Set tmp user directory
    $vardir = $conf->user->dir_output . "/" . $user->id;
    $upload_dir_tmp = $vardir . '/temp';
    dol_add_file_process($upload_dir_tmp, 0, 0);
    $action = 'presend';
}
/*
 * Remove file in email form
 */
if (!empty($_POST['removedfile'])) {
    require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
    // Set tmp user directory
    $vardir = $conf->user->dir_output . "/" . $user->id;
    $upload_dir_tmp = $vardir . '/temp';
 */
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/categories.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$langs->load("categories");
$langs->load("admin");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) {
    $type2label[$key] = $langs->trans($val);
}
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'categories';
//Must be the $element of the class that manage extrafield
if (!$user->admin) {
    accessforbidden();
}
/*
 * Actions
 */
require DOL_DOCUMENT_ROOT . '/core/actions_extrafields.inc.php';
/*
 * View
 */
$textobject = $langs->transnoentitiesnoconv("Categories");
$help_url = 'EN:Module Categories|FR:Module Catégories|ES:Módulo Categorías';
llxHeader('', $langs->trans("Categories"), $help_url);
Example #29
0
                    }
                }
            }
        }
    }
} else {
    if ($action == 'confirm_deletefile' && $confirm == 'yes') {
        if ($object->fetch($id)) {
            $upload_dir = $conf->bank->dir_output;
            $file = $upload_dir . '/' . GETPOST('urlfile');
            // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
            $ret = dol_delete_file($file, 0, 0, 0, $object);
            if ($ret) {
                setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
            } else {
                setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
            }
            Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
            exit;
        }
    }
}
/*
 * View
 */
llxHeader();
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    if ($object->fetch($id, $ref)) {
        $upload_dir = $conf->bank->dir_output . '/' . $object->ref;
        // Onglets
            $res = $link->delete($user);
            $langs->load('link');
            if ($res) {
                setEventMessage($langs->trans("LinkRemoved", $link->label));
            } else {
                setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors');
            }
        }
        header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (!empty($withproject) ? '&withproject=1' : ''));
        exit;
    }
} elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) {
    require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
    $langs->load('link');
    $link = new Link($db);
    $link->id = GETPOST('linkid', 'int');
    $f = $link->fetch();
    if ($f) {
        $link->url = GETPOST('link', 'alpha');
        if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') {
            $link->url = 'http://' . $link->url;
        }
        $link->label = GETPOST('label', 'alpha');
        $res = $link->update($user);
        if (!$res) {
            setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label));
        }
    } else {
        //error fetching
    }
}