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);
             }
         }
     }
 }
Ejemplo n.º 2
0
	/**
	 *    	Renvoi label of a given contrat status
	 *    	@param      statut      	Status id
	 *    	@param      mode          	0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services
	 *		@return     string      	Label
	 */
	function LibStatut($statut,$mode)
	{
		global $langs;
		$langs->load("contracts");
		if ($mode == 0)
		{
			if ($statut == 0) { return $langs->trans("ContractStatusDraft").$text; }
			if ($statut == 1) { return $langs->trans("ContractStatusValidated").$text; }
			if ($statut == 2) { return $langs->trans("ContractStatusClosed").$text; }
		}
		if ($mode == 1)
		{
			if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
			if ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
			if ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
		}
		if ($mode == 2)
		{
			if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); }
			if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); }
			if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); }
		}
		if ($mode == 3)
		{
			if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); }
			if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); }
			if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); }
		}
		if ($mode == 4 || $mode == 6)
		{
			$line=new ContratLigne($this->db);
			$text='';
			if ($mode == 4)
			{
				$text=($this->nbofserviceswait+$this->nbofservicesopened+$this->nbofservicesexpired+$this->nbofservicesclosed);
				$text.=' '.$langs->trans("Services");
				$text.=':     ';
			}
			$text.=$this->nbofserviceswait.' '.$line->LibStatut(0,3).'   ';
			$text.=$this->nbofservicesopened.' '.$line->LibStatut(4,3,0).'   ';
			$text.=$this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).'   ';
			$text.=$this->nbofservicesclosed.' '.$line->LibStatut(5,3);
			return $text;
		}
		if ($mode == 5)
		{
			if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'),'statut0'); }
			if ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); }
			if ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); }
		}
	}
Ejemplo n.º 3
0
        }
        if ($tmp[1] == 'filter=expired') {
            $filter = 'expired';
        }
    }
} else {
    $search_status = $mode;
    if ($filter == 'expired') {
        $search_status .= '&filter=expired';
    }
    if ($filter == 'notexpired') {
        $search_status .= '&filter=notexpired';
    }
}
$staticcontrat = new Contrat($db);
$staticcontratligne = new ContratLigne($db);
$companystatic = new Societe($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
    $search_name = "";
    $search_contract = "";
    $search_service = "";
    $search_status = -1;
    $op1month = "";
    $op1day = "";
    $op1year = "";
    $filter_op1 = "";
    $op2month = "";
    $op2day = "";
    $op2year = "";
    $filter_op2 = "";
    $mode = '';
Ejemplo n.º 4
0
        print '<input type="hidden" name="shipToCountryCode" value="' . $shipToCountryCode . '">' . "\n";
        print '<input type="hidden" name="shipToZip" value="' . $shipToZip . '">' . "\n";
        print '<input type="hidden" name="shipToStreet2" value="' . $shipToStreet2 . '">' . "\n";
        print '<input type="hidden" name="phoneNum" value="' . $phoneNum . '">' . "\n";
    } else {
        print '<!-- Shipping address not complete, so we don t use it -->' . "\n";
    }
    print '<input type="hidden" name="email" value="' . $invoice->thirdparty->email . '">' . "\n";
    print '<input type="hidden" name="desc" value="' . $langs->trans("Invoice") . ' ' . $invoice->ref . '">' . "\n";
}
// Payment on contract line
if (GETPOST("source") == 'contractline' && $valid) {
    $found = true;
    $langs->load("contracts");
    require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
    $contractline = new ContratLigne($db);
    $result = $contractline->fetch('', $ref);
    if ($result < 0) {
        $mesg = $contractline->error;
        $error++;
    } else {
        if ($contractline->fk_contrat > 0) {
            $contract = new Contrat($db);
            $result = $contract->fetch($contractline->fk_contrat);
            if ($result > 0) {
                $result = $contract->fetch_thirdparty($contract->socid);
            } else {
                $mesg = $contract->error;
                $error++;
            }
        } else {
Ejemplo n.º 5
0
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="c.date_contrat";


/*
 * View
 */

$staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db);

$html = new Form($db);

if ($_GET["id"] || $_GET["ref"])
{
	$product = new Product($db);
	if ($_GET["ref"])
	{
		$result = $product->fetch('',$_GET["ref"]);
		$_GET["id"]=$product->id;
	}
	if ($_GET["id"]) $result = $product->fetch($_GET["id"]);

	llxHeader("","",$langs->trans("CardProduct".$product->type));
Ejemplo n.º 6
0
$search_product_category = GETPOST('search_product_category', 'int');
$optioncss = GETPOST('optioncss', 'alpha');
if (!$sortfield) {
    $sortfield = "c.rowid";
}
if (!$sortorder) {
    $sortorder = "DESC";
}
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$staticcontrat = new Contrat($db);
$staticcontratligne = new ContratLigne($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
    $search_name = "";
    $search_contract = "";
    $search_ref_supplier = "";
    $search_user = '';
    $search_sale = '';
    $search_product_category = '';
    $sall = "";
    $search_status = "";
}
if ($search_status == '') {
    $search_status = 1;
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array('c.ref' => 'Ref', 'c.ref_customer' => 'RefCustomer', 'c.ref_supplier' => 'RefSupplier', 's.nom' => "ThirdParty", 'cd.description' => 'Description', 'c.note_public' => 'NotePublic');
Ejemplo n.º 7
0
	print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
	print ' ('.$langs->trans("ToComplete").')';
    $email=$invoice->client->email;
    $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
	print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
}

// Payment on contract line
if (GETPOST("source") == 'contractline')
{
	$found=true;
	$langs->load("contracts");

	require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");

	$contractline=new ContratLigne($db);
	$result=$contractline->fetch('',$_REQUEST["ref"]);
	if ($result < 0)
	{
		$mesg=$contractline->error;
		$error++;
	}
	else
	{
		if ($contractline->fk_contrat > 0)
		{
			$contract=new Contrat($db);
			$result=$contract->fetch($contractline->fk_contrat);
			if ($result > 0)
			{
				$result=$contract->fetch_thirdparty($contract->socid);
Ejemplo n.º 8
0
             $colspan++;
         }
         if ($conf->global->PRODUCT_USE_UNITS) {
             $colspan++;
         }
         // Ligne dates prevues
         print "<tr " . $bc[$var] . ">";
         print '<td colspan="' . $colspan . '">';
         print $langs->trans("DateStartPlanned") . ' ';
         $form->select_date($db->jdate($objp->date_debut), "date_start_update", $usehm, $usehm, $db->jdate($objp->date_debut) > 0 ? 0 : 1, "update");
         print ' &nbsp;&nbsp;' . $langs->trans("DateEndPlanned") . ' ';
         $form->select_date($db->jdate($objp->date_fin), "date_end_update", $usehm, $usehm, $db->jdate($objp->date_fin) > 0 ? 0 : 1, "update");
         print '</td>';
         if (is_array($extralabelslines) && count($extralabelslines) > 0) {
             print '<tr ' . $bc[$var] . '>';
             $line = new ContratLigne($db);
             $line->fetch_optionals($objp->rowid, $extralabelslines);
             print $line->showOptionals($extrafieldsline, 'edit', array('style' => $bc[$var], 'colspan' => $colspan));
             print '</tr>';
         }
         print '</tr>';
     }
     $db->free($result);
 } else {
     dol_print_error($db);
 }
 if ($object->statut > 0) {
     print '<tr ' . $bc[$var] . '>';
     print '<td colspan="' . ($conf->margin->enabled ? 7 : 6) . '"><hr></td>';
     print "</tr>\n";
 }
Ejemplo n.º 9
0
$langs->load("products");
$langs->load("companies");
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$statut = GETPOST('statut') ? GETPOST('statut') : 1;
// Security check
$socid = 0;
$id = GETPOST('id', 'int');
if (!empty($user->societe_id)) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$staticcompany = new Societe($db);
$staticcontrat = new Contrat($db);
$staticcontratligne = new ContratLigne($db);
$productstatic = new Product($db);
/*
 * Action
 */
// None
/*
 * View
 */
$now = dol_now();
llxHeader();
print_fiche_titre($langs->trans("ContractsArea"));
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
// Search contract
Ejemplo n.º 10
0
 } else {
     if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) {
         $object->cloture($user);
     } else {
         if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) {
             $result = $object->delete($user);
             if ($result >= 0) {
                 header("Location: index.php");
                 return;
             } else {
                 setEventMessage($object->error, 'errors');
             }
         } else {
             if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) {
                 if (GETPOST('newcid') > 0) {
                     $contractline = new ContratLigne($db);
                     $result = $contractline->fetch(GETPOST('lineid'));
                     $contractline->fk_contrat = GETPOST('newcid');
                     $result = $contractline->update($user, 1);
                     if ($result >= 0) {
                         header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
                         return;
                     } else {
                         setEventMessage($object->error, 'errors');
                     }
                 } else {
                     setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), 'errors');
                 }
             } else {
                 if ($action == 'update_extras') {
                     // Fill array 'array_options' with data from update form
Ejemplo n.º 11
0
/**
 * Update total of contract lines
 *
 * @param	DoliDB		$db		Database handler
 * @param	Translate	$langs	Object langs
 * @param	Conf		$conf	Object conf
 * @return	void
 */
function migrate_price_contrat($db, $langs, $conf)
{
    $db->begin();
    $tmpmysoc = new Societe($db);
    $tmpmysoc->setMysoc($conf);
    if (empty($tmpmysoc->country_id)) {
        $tmpmysoc->country_id = 0;
    }
    // Ti not have this set to '' or will make sql syntax error.
    print '<tr><td colspan="4">';
    print '<br>';
    print '<b>' . $langs->trans('MigrationContract') . "</b><br>\n";
    // Liste des lignes contrat non a jour
    $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,";
    $sql .= " c.rowid as contratid";
    $sql .= " FROM " . MAIN_DB_PREFIX . "contratdet as cd, " . MAIN_DB_PREFIX . "contrat as c";
    $sql .= " WHERE cd.fk_contrat = c.rowid";
    $sql .= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100 AND cd.subprice > 0) or cd.total_ttc IS NULL)";
    dolibarr_install_syslog("upgrade2::migrate_price_contrat", LOG_DEBUG);
    $resql = $db->query($sql);
    if ($resql) {
        $num = $db->num_rows($resql);
        $i = 0;
        if ($num) {
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $rowid = $obj->rowid;
                $qty = $obj->qty;
                $pu = $obj->subprice;
                $txtva = $obj->tva_taux;
                $remise_percent = $obj->remise_percent;
                $info_bits = $obj->info_bits;
                // On met a jour les 3 nouveaux champs
                $contratligne = new ContratLigne($db);
                //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
                $contratligne->id = $rowid;
                $result = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, 'HT', $info_bits, 0, $tmpmysoc);
                $total_ht = $result[0];
                $total_tva = $result[1];
                $total_ttc = $result[2];
                $contratligne->total_ht = $total_ht;
                $contratligne->total_tva = $total_tva;
                $contratligne->total_ttc = $total_ttc;
                dolibarr_install_syslog("upgrade2: Line {$rowid}: contratdetid={$obj->rowid} pu={$pu} qty={$qty} tva_taux={$txtva} remise_percent={$remise_percent} -> {$total_ht}, {$total_tva}, {$total_ttc}");
                print ". ";
                $contratligne->update_total();
                $i++;
            }
        } else {
            print $langs->trans("AlreadyDone");
        }
        $db->free($resql);
        $db->commit();
    } else {
        print "Error #1 " . $db->error();
        $db->rollback();
    }
    print '<br>';
    print '</td></tr>';
}
Ejemplo n.º 12
0
	/**
	 *      \brief      Charge les donnees en memoire pour affichage ulterieur
	 *      \param      $max        Nombre maximum d'enregistrements a charger
	 */
	function loadBox($max=5)
	{
		global $user, $langs, $db, $conf;

		$this->max=$max;

		include_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
		$contratlignestatic=new ContratLigne($db);

		$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max));

		if ($user->rights->service->lire && $user->rights->contrat->lire)
		{
			$sql = "SELECT s.nom, s.rowid as socid,";
			$sql.= " c.rowid,";
			$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut,";
			$sql.= " p.rowid as pid, p.label, p.fk_product_type";
			$sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
			$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
			$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
			$sql.= ", ".MAIN_DB_PREFIX."product as p";
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
			$sql.= ")";
			$sql.= " WHERE s.rowid = c.fk_soc";
			$sql.= " AND s.entity = ".$conf->entity;
			$sql.= " AND c.rowid = cd.fk_contrat";
			$sql.= " AND cd.fk_product = p.rowid";
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = ".$user->societe_id;
			$sql.= $db->order("c.tms","DESC");
			$sql.= $db->plimit($max, 0);

			$result = $db->query($sql);
			if ($result)
			{
				$num = $db->num_rows($result);
				$now=gmmktime();

				$i = 0;

				while ($i < $num)
				{
					$objp = $db->fetch_object($result);
					$datem=$db->jdate($objp->datem);

					// Multilangs
					if ($conf->global->MAIN_MULTILANGS) // si l'option est active
					{
						$sqld = "SELECT label";
						$sqld.= " FROM ".MAIN_DB_PREFIX."product_lang";
						$sqld.= " WHERE fk_product=".$objp->pid;
						$sqld.= " AND lang='". $langs->getDefaultLang() ."'";
						$sqld.= " LIMIT 1";

						$resultd = $db->query($sqld);
						if ($resultd)
						{
							$objtp = $db->fetch_object($resultd);
							if ($objtp->label != '') $objp->label = $objtp->label;
						}
					}

					$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
                    'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
                    'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);

					$this->info_box_contents[$i][1] = array('td' => 'align="left"',
                    'text' => $objp->label,
                    'maxlength' => 16,
                    'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);

					$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
                    'logo' => 'company',
                    'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);

					$this->info_box_contents[$i][3] = array('td' => 'align="left"',
                    'text' => $objp->nom,
                    'maxlength' => 28,
                    'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);

					$this->info_box_contents[$i][4] = array('td' => 'align="right"',
                    'text' => dol_print_date($datem,'day'));

					$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
                    'text' => $contratlignestatic->LibStatut($objp->statut,3)
					);

					$i++;
				}
				if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoContractedProducts"));
			}
			else
			{
				$this->info_box_contents[0][0] = array(	'td' => 'align="left"',
    	        										'maxlength'=>500,
	            										'text' => ($db->error().' sql='.$sql));
			}
		}
		else {
			$this->info_box_contents[0][0] = array('td' => 'align="left"',
            'text' => $langs->trans("ReadPermissionNotAllowed"));
		}

	}
Ejemplo n.º 13
0
			return;
		}
		else
		{
			$mesg='<div class="error">'.$object->error.'</div>';
		}
    }
}

if ($action == 'confirm_move' && $_REQUEST["confirm"] == 'yes')
{
    if ($user->rights->contrat->creer)
    {
    	if ($_POST['newcid'] > 0)
    	{
    		$contractline = new ContratLigne($db);
    		$result=$contractline->fetch($_GET["lineid"]);
	        $contractline->fk_contrat = $_POST["newcid"];
	        $result=$contractline->update($user,1);
	        if ($result >= 0)
			{
				Header("Location: ".$_SERVER['PHP_SELF'].'?id='.$_GET['id']);
				return;
			}
			else
			{
				$mesg='<div class="error">'.$object->error.'</div>';
			}
    	}
		else
		{
Ejemplo n.º 14
0
function migrate_price_contrat($db,$langs,$conf)
{
	$db->begin();

	print '<tr><td colspan="4">';

	print '<br>';
	print '<b>'.$langs->trans('MigrationContract')."</b><br>\n";

	// Liste des lignes contrat non a jour
	$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,";
	$sql.= " c.rowid as contratid";
	$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
	$sql.= " WHERE cd.fk_contrat = c.rowid";
	$sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100 AND cd.subprice > 0) or cd.total_ttc IS NULL)";

	dolibarr_install_syslog("upgrade2::migrate_price_contrat sql=".$sql);
	$resql=$db->query($sql);
	if ($resql)
	{
		$num = $db->num_rows($resql);
		$i = 0;
		if ($num)
		{
			while ($i < $num)
			{
				$obj = $db->fetch_object($resql);

				$rowid = $obj->rowid;
				$qty = $obj->qty;
				$pu = $obj->subprice;
				$txtva = $obj->tva_taux;
				$remise_percent = $obj->remise_percent;
				$remise_percent_global = $obj->remise_percent_global;
				$info_bits = $obj->info_bits;

				// On met a jour les 3 nouveaux champs
				$contratligne= new ContratLigne($db);
				//$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis
				$contratligne->rowid=$rowid;

				$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits);
				$total_ht  = $result[0];
				$total_tva = $result[1];
				$total_ttc = $result[2];

				$contratligne->total_ht  = $total_ht;
				$contratligne->total_tva = $total_tva;
				$contratligne->total_ttc = $total_ttc;

				dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
				print ". ";
				$contratligne->update_total($rowid);


				/* On touche pas a contrat mere
				 $propal = new Propal($db);
				 $propal->id=$obj->rowid;
				 if ( $propal->fetch($propal->id) >= 0 )
				 {
					if ( $propal->update_price() > 0 )
					{
					print ". ";
					}
					else
					{
					print "Error id=".$propal->id;
					$err++;
					}
					}
					else
					{
					print "Error #3";
					$err++;
					}
					*/
				$i++;
			}
		}
		else
		{
			print $langs->trans("AlreadyDone");
		}

		$db->free($resql);

		$db->commit();
	}
	else
	{
		print "Error #1 ".$db->error();
		$err++;

		$db->rollback();
	}

	print '<br>';

	print '</td></tr>';
}
Ejemplo n.º 15
0
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "DESC";
}
if (!$sortfield) {
    $sortfield = "c.date_contrat";
}
/*
 * View
 */
$staticcontrat = new Contrat($db);
$staticcontratligne = new ContratLigne($db);
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    $product = new Product($db);
    $result = $product->fetch($id, $ref);
    $object = $product;
    $parameters = array('id' => $id);
    $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action);
    // Note that $action and $object may have been modified by some hooks
    if ($reshook < 0) {
        setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
    }
    llxHeader("", "", $langs->trans("CardProduct" . $product->type));
    if ($result > 0) {
        $head = product_prepare_head($product);
        $titre = $langs->trans("CardProduct" . $product->type);