if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
$mesg = '';
$object = new Product($db);
if ($id > 0 || !empty($ref)) {
    $result = $object->fetch($id, $ref);
    $dir = !empty($conf->product->multidir_output[$object->entity]) ? $conf->product->multidir_output[$object->entity] : $conf->service->multidir_output[$object->entity];
}
/*
 * Actions
 */
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    if ($object->id) {
        $result = $object->add_photo($dir, $_FILES['userfile']);
    }
}
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer)) {
    $object->delete_photo($dir . "/" . $_GET["file"]);
}
if ($action == 'addthumb' && $_GET["file"]) {
    $object->add_thumb($dir . "/" . $_GET["file"]);
}
/*
 *	View
 */
$form = new Form($db);
if ($object->id) {
    llxHeader("", "", $langs->trans("CardProduct" . $object->type));
    /*
Example #2
0
 *  \brief      Page de la fiche produit
 */
require "../../main.inc.php";
require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php";
$id = GETPOST('id', 'int');
if (!$user->rights->produit->lire && !$user->rights->service->lire) {
    accessforbidden();
}
$object = new Product($db);
/*
 *	View
 */
if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    if ($id) {
        $result = $object->fetch($id);
        $object->add_photo($conf->product->multidir_output[$object->entity], $_FILES['photofile']);
    }
}
/*
 *
 */
llxHeader("", "", $langs->trans("CardProduct0"));
/*
 * Fiche produit
 */
if ($id) {
    $result = $object->fetch($id);
    if ($result) {
        /*
         *  En mode visu
         */
Example #3
0
$mesg = '';
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);


/*
 * Actions
 */

if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
	if ($_GET["id"])
	{
		$product = new Product($db);
		$result = $product->fetch($_GET["id"]);

		$result = $product->add_photo($dir, $_FILES['userfile']);
	}
}

if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confirm'] == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer))
{
	$product = new Product($db);
	$product->delete_photo($dir."/".$_GET["file"]);
}

if ($_GET["action"] == 'addthumb' && $_GET["file"])
{
	$product = new Product($db);
	$product->add_thumb($dir."/".$_GET["file"]);
}
Example #4
0
if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden();


/*
 *	View
 */

if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
	if ($_GET["id"])
	{
		$product = new Product($db);
		$result = $product->fetch($_GET["id"]);

		$product->add_photo($conf->product->dir_output, $_FILES['photofile']);
	}
}
/*
 *
 */
llxHeader("","",$langs->trans("CardProduct0"));

/*
 * Fiche produit
 */
if ($_GET["id"])
{
	$product = new Product($db);
	$result = $product->fetch($_GET["id"]);