Merge remote-tracking branch 'refs/remotes/Dolibarr/3.8' into 3.8

This commit is contained in:
fappels 2015-11-02 16:34:25 +01:00
commit 5246557493
68 changed files with 567 additions and 396 deletions

View File

@ -533,6 +533,12 @@ Dolibarr better:
warehouse module and your Point Of Sale module setup if you use one. warehouse module and your Point Of Sale module setup if you use one.
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
***** ChangeLog for 3.6.5 compared to 3.6.4 *****
- Fix: [ bug #1776 ] Undefined $deliverycompany variable in pdf_build_address
- Fix: [ bug #1794 ] Error when cloning Proposal gives error in a malformed page
***** ChangeLog for 3.6.4 compared to 3.6.3 *****
- Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask
***** ChangeLog for 3.6.3 compared to 3.6.2 ***** ***** ChangeLog for 3.6.3 compared to 3.6.2 *****
- Fix: ref_ext was not saved when recording a customer order from web service - Fix: ref_ext was not saved when recording a customer order from web service

View File

@ -244,7 +244,7 @@ class Skeleton_Class extends CommonObject
} }
if (!empty($sortfield)) { if (!empty($sortfield)) {
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder; $sql .= $this->db->order($sortfield,$sortorder);
} }
if (!empty($limit)) { if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset); $sql .= ' ' . $this->db->plimit($limit + 1, $offset);

View File

@ -1991,12 +1991,14 @@ class Adherent extends CommonObject
// Process // Process
foreach ($to_del as $del) { foreach ($to_del as $del) {
$c->fetch($del); if ($c->fetch($del) > 0) {
$c->del_type($this, 'member'); $c->del_type($this, 'member');
}
} }
foreach ($to_add as $add) { foreach ($to_add as $add) {
$c->fetch($add); if ($c->fetch($add) > 0) {
$c->add_type($this, 'member'); $c->add_type($this, 'member');
}
} }
return; return;

View File

@ -292,6 +292,7 @@ $var=!$var;
$this->NbRepeat = $tabConf[4]; $this->NbRepeat = $tabConf[4];
$this->WithoutAmbi = $tabConf[5]; $this->WithoutAmbi = $tabConf[5];
*/ */
print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>'; print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
@ -333,12 +334,16 @@ $var=!$var;
print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>'; print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
print '</tr>'; print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2"></td><td width="103" align="center"><a id="linkChangePattern">'.$langs->trans("Save").'</a></td>';
print '</tr>';
print '</table>'; print '</table>';
print '<br>';
print '<table align="right">';
print '<tr><td>';
print '<a class="button" id="linkChangePattern">'.$langs->trans("Save").'</a>';
print '</td></tr>';
print '</table>';
print '<br><br>';
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print ' function getStringArg(){'; print ' function getStringArg(){';
print ' var pattern = "";'; print ' var pattern = "";';
@ -389,7 +394,7 @@ $var=!$var;
// Cryptage mot de passe // Cryptage mot de passe
print '<br>'; print '<br>';
$var=true; $var=true;
print "<form method=\"post\" action=\"security.php\">"; print "<form method=\"post\" action=\"" . $_SERVER["PHP_SELF"] . "\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"encrypt\">"; print "<input type=\"hidden\" name=\"action\" value=\"encrypt\">";

View File

@ -323,7 +323,7 @@ if ($action == 'add')
unset($_SESSION['assignedtouser']); unset($_SESSION['assignedtouser']);
$moreparam=''; $moreparam='';
if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view. if ($user->id != $object->userownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
$db->commit(); $db->commit();
if (! empty($backtopage)) if (! empty($backtopage))

View File

@ -199,7 +199,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (
if ($filtert > 0 || $usergroup > 0) if ($filtert > 0 || $usergroup > 0)
{ {
$sql.= " AND ("; $sql.= " AND (";
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")";
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")"; $sql.= ")";
} }

View File

@ -128,7 +128,7 @@ if (empty($reshook))
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') if ($action == 'confirm_clone' && $confirm == 'yes')
{ {
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) if (! GETPOST('socid', 3))
{ {
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
} }
@ -140,7 +140,7 @@ if (empty($reshook))
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit(); exit();
} else { } else {
setEventMessage($object->error, 'errors'); if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
$action = ''; $action = '';
} }
} }
@ -2223,7 +2223,7 @@ if ($action == 'create')
} }
$arrayofinvoiceforpropal = $object->getInvoiceArrayList(); $arrayofinvoiceforpropal = $object->getInvoiceArrayList();
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES)) if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED))
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
} }

View File

@ -47,8 +47,9 @@ $result = restrictedArea($user, 'propal', $id);
* View Mode * View Mode
*/ */
llxHeader(); $form = new Form($db);
llxHeader();
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
@ -68,10 +69,12 @@ if ($id > 0 || ! empty($ref))
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref $linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$object->ref.'</td>'; // Ref
print '</tr>'; print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Ref client // Ref client
print '<tr><td>'.$langs->trans('RefCustomer').'</td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
@ -144,7 +147,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n"; print "</table>\n";
// Conversion du PDF en image png si fichier png non existant // Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis)) if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{ {
if (class_exists("Imagick")) if (class_exists("Imagick"))
{ {

View File

@ -1063,7 +1063,7 @@ class Propal extends CommonObject
{ {
global $db, $user,$langs,$conf,$hookmanager; global $db, $user,$langs,$conf,$hookmanager;
dol_include_once('/projet/class.project.class.php'); dol_include_once('/projet/class/project.class.php');
$this->context['createfromclone']='createfromclone'; $this->context['createfromclone']='createfromclone';
@ -1076,44 +1076,42 @@ class Propal extends CommonObject
foreach($this->lines as $line) foreach($this->lines as $line)
$line->fetch_optionals($line->rowid); $line->fetch_optionals($line->rowid);
// Load source object // Load dest object
$objFrom = dol_clone($this); $clonedObj = clone $this;
$objsoc=new Societe($this->db); $objsoc=new Societe($this->db);
// Change socid if needed // Change socid if needed
if (! empty($socid) && $socid != $this->socid) if (! empty($socid) && $socid != $clonedObj->socid)
{ {
if ($objsoc->fetch($socid) > 0) if ($objsoc->fetch($socid) > 0)
{ {
$this->socid = $objsoc->id; $clonedObj->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $clonedObj->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $clonedObj->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$clonedObj->fk_delivery_address = '';
$project = new Project($db); $project = new Project($db);
if ($this->fk_project > 0 && $project->fetch($this->fk_project)) {
if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) { if ($project->socid <= 0) $clonedObj->fk_project = $this->fk_project;
if($project->socid <= 0) $this->fk_project = $objFrom->fk_project; else $clonedObj->fk_project = '';
else $this->fk_project = '';
} else { } else {
$this->fk_project = ''; $clonedObj->fk_project = '';
} }
$this->fk_delivery_address = '';
} }
// reset ref_client // reset ref_client
$this->ref_client = ''; $clonedObj->ref_client = '';
// TODO Change product price if multi-prices // TODO Change product price if multi-prices
} }
else else
{ {
$objsoc->fetch($this->socid); $objsoc->fetch($clonedObj->socid);
} }
$this->id=0; $clonedObj->id=0;
$this->statut=self::STATUS_DRAFT; $clonedObj->statut=self::STATUS_DRAFT;
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
{ {
@ -1122,32 +1120,32 @@ class Propal extends CommonObject
} }
// Clear fields // Clear fields
$this->user_author = $user->id; $clonedObj->user_author = $user->id;
$this->user_valid = ''; $clonedObj->user_valid = '';
$this->date = $now; $clonedObj->date = $now;
$this->datep = $now; // deprecated $clonedObj->datep = $now; // deprecated
$this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600); $clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = '';
// Set ref // Set ref
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php'; require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php';
$obj = $conf->global->PROPALE_ADDON; $obj = $conf->global->PROPALE_ADDON;
$modPropale = new $obj; $modPropale = new $obj;
$this->ref = $modPropale->getNextValue($objsoc,$this); $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj);
// Create clone // Create clone
$result=$this->create($user); $result=$clonedObj->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
else else
{ {
// copy internal contacts // copy internal contacts
if ($this->copy_linked_contact($objFrom, 'internal') < 0) if ($clonedObj->copy_linked_contact($this, 'internal') < 0)
$error++; $error++;
// copy external contacts if same company // copy external contacts if same company
elseif ($objFrom->socid == $this->socid) elseif ($this->socid == $clonedObj->socid)
{ {
if ($this->copy_linked_contact($objFrom, 'external') < 0) if ($clonedObj->copy_linked_contact($this, 'external') < 0)
$error++; $error++;
} }
} }
@ -1157,9 +1155,9 @@ class Propal extends CommonObject
// Hook of thirdparty module // Hook of thirdparty module
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$parameters=array('objFrom'=>$objFrom); $parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
@ -1175,7 +1173,7 @@ class Propal extends CommonObject
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
return $this->id; return $clonedObj->id;
} }
else else
{ {
@ -2124,26 +2122,26 @@ class Propal extends CommonObject
$this->fetchObjectLinked($id,$this->element); $this->fetchObjectLinked($id,$this->element);
foreach($this->linkedObjectsIds as $objecttype => $objectid) foreach($this->linkedObjectsIds as $objecttype => $objectid)
{ {
$numi=count($objectid); // Nouveau système du comon object renvoi des rowid et non un id linéaire de 1 à n
for ($i=0;$i<$numi;$i++) // On parcourt donc une liste d'objets en tant qu'objet unique
foreach($objectid as $key => $object)
{ {
// Cas des factures liees directement // Cas des factures liees directement
if ($objecttype == 'facture') if ($objecttype == 'facture')
{ {
$linkedInvoices[] = $objectid[$i]; $linkedInvoices[] = $object;
} }
// Cas des factures liees par un autre objet (ex: commande) // Cas des factures liees par un autre objet (ex: commande)
else else
{ {
$this->fetchObjectLinked($objectid[$i],$objecttype); $this->fetchObjectLinked($object,$objecttype);
foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid) foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid)
{ {
$numj=count($subobjectid); foreach($subobjectid as $subkey => $subobject)
for ($j=0;$j<$numj;$j++)
{ {
if ($subobjecttype == 'facture') if ($subobjecttype == 'facture')
{ {
$linkedInvoices[] = $subobjectid[$j]; $linkedInvoices[] = $subobject;
} }
} }
} }

View File

@ -47,6 +47,8 @@ $result=restrictedArea($user,'commande',$id,'');
* View Mode * View Mode
*/ */
$form = new Form($db);
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@ -64,9 +66,12 @@ if ($id > 0 || ! empty($ref))
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref //$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
print '<tr><td width="25%">'.$langs->trans("Ref")."</td>";
print '<td colspan="5">'.$object->ref.'</td></tr>'; // Ref
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Ref cde client // Ref cde client
print '<tr><td>'.$langs->trans('RefCustomer').'</td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
@ -142,7 +147,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n"; print "</table>\n";
// Conversion du PDF en image png si fichier png non existant // Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis)) if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{ {
if (class_exists("Imagick")) if (class_exists("Imagick"))
{ {

View File

@ -978,6 +978,7 @@ class Commande extends CommonOrder
} }
$this->id=0; $this->id=0;
$this->ref = '';
$this->statut=self::STATUS_DRAFT; $this->statut=self::STATUS_DRAFT;
// Clear fields // Clear fields
@ -987,13 +988,6 @@ class Commande extends CommonOrder
$this->date_validation = ''; $this->date_validation = '';
$this->ref_client = ''; $this->ref_client = '';
// Set ref
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$conf->global->COMMANDE_ADDON.'.php';
$obj = $conf->global->COMMANDE_ADDON;
$modCommande = new $obj;
$this->ref = $modCommande->getNextValue($objsoc,$this);
// Create clone // Create clone
$result=$this->create($user); $result=$this->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
@ -1045,116 +1039,112 @@ class Commande extends CommonOrder
$error=0; $error=0;
// Signed proposal
if ($object->statut == 2) $this->date_commande = dol_now();
$this->source = 0;
$num=count($object->lines);
for ($i = 0; $i < $num; $i++)
{ {
$this->date_commande = dol_now(); $line = new OrderLine($this->db);
$this->source = 0;
$num=count($object->lines); $line->libelle = $object->lines[$i]->libelle;
for ($i = 0; $i < $num; $i++) $line->label = $object->lines[$i]->label;
{ $line->desc = $object->lines[$i]->desc;
$line = new OrderLine($this->db); $line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit;
$line->libelle = $object->lines[$i]->libelle; $line->date_start = $object->lines[$i]->date_start;
$line->label = $object->lines[$i]->label; $line->date_end = $object->lines[$i]->date_end;
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit;
$line->date_start = $object->lines[$i]->date_start; $line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$line->date_end = $object->lines[$i]->date_end; $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->fk_fournprice = $object->lines[$i]->fk_fournprice; $line->marge_tx = $marginInfos[1];
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $line->marque_tx = $marginInfos[2];
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$this->lines[$i] = $line;
}
$this->socid = $object->socid;
$this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id;
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
$this->note_private = $object->note_private;
$this->note_public = $object->note_public;
$this->origin = $object->element;
$this->origin_id = $object->id;
// get extrafields from original line // get extrafields from original line
$object->fetch_optionals($object->id); $object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$e = new ExtraFields($db); $this->lines[$i] = $line;
$element_extrafields = $e->fetch_name_optionals_label($this->element); }
foreach($object->array_options as $options_key => $value) { $this->socid = $object->socid;
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){ $this->fk_project = $object->fk_project;
$this->array_options[$options_key] = $value; $this->cond_reglement_id = $object->cond_reglement_id;
} $this->mode_reglement_id = $object->mode_reglement_id;
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
$this->note_private = $object->note_private;
$this->note_public = $object->note_public;
$this->origin = $object->element;
$this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
} }
// Possibility to add external linked objects with hooks }
$this->linked_objects[$this->origin] = $this->origin_id; // Possibility to add external linked objects with hooks
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) $this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
{
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
}
$ret = $this->create($user);
if ($ret > 0)
{
// Actions hooked (by external module)
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
{ {
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); // Ne pas passer par la commande provisoire
} if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
$ret = $this->create($user);
if ($ret > 0)
{
// Actions hooked (by external module)
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
{ {
// Ne pas passer par la commande provisoire $this->fetch($ret);
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1) $this->valid($user);
{
$this->fetch($ret);
$this->valid($user);
}
return $ret;
} }
else return -1; return $ret;
} }
else return -1; else return -1;
} }
else return 0; else return -1;
} }

View File

@ -952,7 +952,7 @@ if ($id > 0 || ! empty($ref))
if ($sep > 0) print '&nbsp;'; // If we had at least one line in future if ($sep > 0) print '&nbsp;'; // If we had at least one line in future
else print $langs->trans("CurrentBalance"); else print $langs->trans("CurrentBalance");
print ' '.$object->currency_code.'</td>'; print ' '.$object->currency_code.'</td>';
print '<td align="right" class="nowrap"><b>'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>'; print '<td align="right" class="nowrap"><b>'.price($total, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
} else { } else {

View File

@ -1737,40 +1737,41 @@ if (empty($reshook))
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
} }
if ($result >= 0) { if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit(); exit();
} else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} else { } else {
setEventMessage($object->error, 'errors'); if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} else {
setEventMessage($object->error, 'errors');
}
} }
} }
}
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut') else if ($action == 'swapstatut')
{ {
if ($object->fetch($id)) { if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne')); $result = $object->swapContactStatus(GETPOST('ligne'));
} else { } else {
dol_print_error($db); dol_print_error($db);
}
}
// Efface un contact
else if ($action == 'deletecontact')
{
$object->fetch($id);
$result = $object->delete_contact($lineid);
if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit();
} else {
dol_print_error($db);
} }
}
// Efface un contact
else if ($action == 'deletecontact')
{
$object->fetch($id);
$result = $object->delete_contact($lineid);
if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit();
} else {
dol_print_error($db);
} }
} }
@ -1790,17 +1791,16 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks // some hooks
if (empty($reshook)) { if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields();
if ($result < 0) { if ($result < 0) {
$error ++;
}
} else if ($reshook < 0)
$error ++; $error ++;
} }
} else if ($reshook < 0)
if ($error) $error ++;
$action = 'edit_extras';
} }
if ($error)
$action = 'edit_extras';
} }
} }
@ -1877,7 +1877,7 @@ if ($action == 'create')
$objectsrc->fetch_lines(); $objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty(); $objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project);
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
@ -2257,9 +2257,6 @@ if ($action == 'create')
// Project // Project
if (! empty($conf->projet->enabled) && $socid > 0) if (! empty($conf->projet->enabled) && $socid > 0)
{ {
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);

View File

@ -29,6 +29,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -79,10 +80,21 @@ if ($id > 0 || ! empty($ref))
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$object->ref.'</td>'; // Ref
print '</tr>'; print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
$morehtmlref = '';
$discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id);
if ($result > 0) {
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
}
if ($result < 0) {
dol_print_error('', $discount->error);
}
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
print '</td></tr>';
// Ref customer // Ref customer
print '<tr><td>'.$langs->trans('RefCustomer').'</td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
@ -280,7 +292,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n"; print "</table>\n";
// Conversion du PDF en image png si fichier png non existant // Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis)) if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{ {
if (class_exists("Imagick")) if (class_exists("Imagick"))
{ {

View File

@ -69,7 +69,7 @@ $search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_societe=GETPOST('search_societe','alpha'); $search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('search_status','alpha'); $search_status=GETPOST('search_status','int');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -270,6 +270,7 @@ if ($resql)
if ($search_user > 0) $param.='&search_user=' .$search_user; if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png'); print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png');
$i = 0; $i = 0;

View File

@ -417,6 +417,7 @@ $search_societe = GETPOST("search_societe");
$search_paymentmode = GETPOST("search_paymentmode"); $search_paymentmode = GETPOST("search_paymentmode");
$search_montant_ht = GETPOST("search_montant_ht"); $search_montant_ht = GETPOST("search_montant_ht");
$search_montant_ttc = GETPOST("search_montant_ttc"); $search_montant_ttc = GETPOST("search_montant_ttc");
$search_status = GETPOST("search_status");
$late = GETPOST("late"); $late = GETPOST("late");
// Do we click on purge search criteria ? // Do we click on purge search criteria ?
@ -428,6 +429,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_paymentmode=''; $search_paymentmode='';
$search_montant_ht=''; $search_montant_ht='';
$search_montant_ttc=''; $search_montant_ttc='';
$search_status='';
} }
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -483,6 +485,7 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmo
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'"; if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'"; if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'"; if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
if ($search_status) $sql .= " AND f.fk_statut = ".$search_status;
if ($month > 0) if ($month > 0)
{ {
if ($year > 0) if ($year > 0)
@ -528,6 +531,7 @@ if ($resql)
if ($search_societe) $param.='&amp;search_paymentmode='.urlencode($search_paymentmode); if ($search_societe) $param.='&amp;search_paymentmode='.urlencode($search_paymentmode);
if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc); if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status) $param.='&amp;search_status='.urlencode($search_status);
if ($late) $param.='&amp;late='.urlencode($late); if ($late) $param.='&amp;late='.urlencode($late);
if ($mode) $param.='&amp;mode='.urlencode($mode); if ($mode) $param.='&amp;mode='.urlencode($mode);
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;

View File

@ -79,7 +79,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{ {
$dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); $dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); $dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount'); $amount=price2num(GETPOST('amount'));
$actioncode=GETPOST('actioncode'); $actioncode=GETPOST('actioncode');
if (! $dateech) if (! $dateech)
{ {
@ -114,7 +114,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$chargesociales->lib=GETPOST('label'); $chargesociales->lib=GETPOST('label');
$chargesociales->date_ech=$dateech; $chargesociales->date_ech=$dateech;
$chargesociales->periode=$dateperiod; $chargesociales->periode=$dateperiod;
$chargesociales->amount=price2num($amount); $chargesociales->amount=$amount;
$id=$chargesociales->create($user); $id=$chargesociales->create($user);
if ($id <= 0) if ($id <= 0)
@ -130,7 +130,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
{ {
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); $dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); $dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount'); $amount=price2num(GETPOST('amount'));
if (! $dateech) if (! $dateech)
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
@ -146,7 +146,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
$action = 'edit'; $action = 'edit';
} }
else elseif (! is_numeric($amount))
{
setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors');
$action = 'create';
}
else
{ {
$chargesociales=new ChargeSociales($db); $chargesociales=new ChargeSociales($db);
$result=$chargesociales->fetch($id); $result=$chargesociales->fetch($id);

View File

@ -1155,12 +1155,14 @@ class Contact extends CommonObject
// Process // Process
foreach ($to_del as $del) { foreach ($to_del as $del) {
$c->fetch($del); if ($c->fetch($del) > 0) {
$c->del_type($this, 'contact'); $c->del_type($this, 'contact');
}
} }
foreach ($to_add as $add) { foreach ($to_add as $add) {
$c->fetch($add); if ($c->fetch($add) > 0) {
$c->add_type($this, 'contact'); $c->add_type($this, 'contact');
}
} }
return; return;

View File

@ -1317,7 +1317,7 @@ else
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,"; $sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,"; $sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
$sql.= " cd.fk_unit,"; $sql.= " cd.fk_unit,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id; $sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id;
@ -1352,6 +1352,7 @@ else
$productstatic->id=$objp->fk_product; $productstatic->id=$objp->fk_product;
$productstatic->type=$objp->ptype; $productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref; $productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
$text = $productstatic->getNomUrl(1,'',20); $text = $productstatic->getNomUrl(1,'',20);
if ($objp->label) if ($objp->label)
{ {
@ -1485,6 +1486,7 @@ else
$productstatic->id=$objp->fk_product; $productstatic->id=$objp->fk_product;
$productstatic->type=$objp->ptype; $productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref; $productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
print $productstatic->getNomUrl(1,'',20); print $productstatic->getNomUrl(1,'',20);
print $objp->label?' - '.dol_trunc($objp->label,16):''; print $objp->label?' - '.dol_trunc($objp->label,16):'';
print '<br>'; print '<br>';

View File

@ -371,7 +371,7 @@ print '<br>';
$sql = "SELECT c.ref, c.fk_soc, "; $sql = "SELECT c.ref, c.fk_soc, ";
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,"; $sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
$sql.= " s.nom as name,"; $sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -413,6 +413,7 @@ if ($resql)
$productstatic->id=$obj->fk_product; $productstatic->id=$obj->fk_product;
$productstatic->type=$obj->ptype; $productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref; $productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20); print $productstatic->getNomUrl(1,'',20);
} }
else else
@ -449,7 +450,7 @@ print '<br>';
// Not activated services // Not activated services
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,"; $sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
$sql.= " s.nom as name,"; $sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -493,6 +494,7 @@ if ($resql)
$productstatic->id=$obj->fk_product; $productstatic->id=$obj->fk_product;
$productstatic->type=$obj->ptype; $productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref; $productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20); print $productstatic->getNomUrl(1,'',20);
} }
else else
@ -528,7 +530,7 @@ print '<br>';
// Expired services // Expired services
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,"; $sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
$sql.= " s.nom as name,"; $sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -573,6 +575,7 @@ if ($resql)
$productstatic->id=$obj->fk_product; $productstatic->id=$obj->fk_product;
$productstatic->type=$obj->ptype; $productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref; $productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20); print $productstatic->getNomUrl(1,'',20);
} }
else else

View File

@ -98,7 +98,7 @@ llxHeader();
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
$sql.= " s.rowid as socid, s.nom as name,"; $sql.= " s.rowid as socid, s.nom as name,";
$sql.= " cd.rowid, cd.description, cd.statut,"; $sql.= " cd.rowid, cd.description, cd.statut,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,"; $sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= " cd.date_ouverture_prevue,"; $sql.= " cd.date_ouverture_prevue,";
$sql.= " cd.date_ouverture,"; $sql.= " cd.date_ouverture,";
@ -225,6 +225,7 @@ if ($resql)
$productstatic->id=$obj->pid; $productstatic->id=$obj->pid;
$productstatic->type=$obj->ptype; $productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref; $productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20); print $productstatic->getNomUrl(1,'',20);
print $obj->label?' - '.dol_trunc($obj->label,16):''; print $obj->label?' - '.dol_trunc($obj->label,16):'';
if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description); if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);

View File

@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire) if ($user->rights->produit->lire || $user->rights->service->lire)
{ {
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression"; $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
@ -103,6 +103,7 @@ class box_produits extends ModeleBoxes
$productstatic->ref = $objp->ref; $productstatic->ref = $objp->ref;
$productstatic->type = $objp->fk_product_type; $productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label; $productstatic->label = $objp->label;
$productstatic->entity = $objp->entity;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',

View File

@ -66,7 +66,7 @@ class box_produits_alerte_stock extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire) if ($user->rights->produit->lire || $user->rights->service->lire)
{ {
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,"; $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,p.entity,";
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock"; $sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
@ -110,6 +110,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$productstatic->ref = $objp->ref; $productstatic->ref = $objp->ref;
$productstatic->type = $objp->fk_product_type; $productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label; $productstatic->label = $objp->label;
$productstatic->entity = $objp->entity;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',

View File

@ -75,6 +75,7 @@ abstract class CommonDocGenerator
'myuser_mobile'=>$user->user_mobile, 'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->email, 'myuser_email'=>$user->email,
'myuser_logo'=>$user->photo, 'myuser_logo'=>$user->photo,
'myuser_job'=>$user->job,
'myuser_web'=>'' // url not exist in $user object 'myuser_web'=>'' // url not exist in $user object
); );
} }
@ -388,11 +389,16 @@ abstract class CommonDocGenerator
// Add vat by rates // Add vat by rates
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
$vatformated=vatrate($line->tva_tx);
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
} }
// Retrieve extrafields // Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) if (is_array($object->array_options) && count($object->array_options))
{ {

View File

@ -739,10 +739,10 @@ class ExtraFields
elseif ($type == 'select') elseif ($type == 'select')
{ {
$out = ''; $out = '';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT); $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
} }
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>'; $out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
@ -760,10 +760,10 @@ class ExtraFields
elseif ($type == 'sellist') elseif ($type == 'sellist')
{ {
$out = ''; $out = '';
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT); $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
} }
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>'; $out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';

View File

@ -3233,7 +3233,7 @@ class Form
if (! empty($more)) { if (! empty($more)) {
$formconfirm.= '<div class="confirmquestions">'.$more.'</div>'; $formconfirm.= '<div class="confirmquestions">'.$more.'</div>';
} }
$formconfirm.= ($question ? '<div class="confirmmessage"'.img_help('','').' '.$question . '</div>': ''); $formconfirm.= ($question ? '<div class="confirmmessage">'.img_help('','').' '.$question . '</div>': '');
$formconfirm.= '</div>'."\n"; $formconfirm.= '</div>'."\n";
$formconfirm.= "\n<!-- begin ajax form_confirm page=".$page." -->\n"; $formconfirm.= "\n<!-- begin ajax form_confirm page=".$page." -->\n";
@ -5135,9 +5135,10 @@ class Form
* @param int $height Height of photo (auto if 0) * @param int $height Height of photo (auto if 0)
* @param int $caneditfield Add edit fields * @param int $caneditfield Add edit fields
* @param string $cssclass CSS name to use on img for photo * @param string $cssclass CSS name to use on img for photo
* @param string $imagesize 'mini', 'small' or '' (original)
* @return string HTML code to output photo * @return string HTML code to output photo
*/ */
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin') static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='')
{ {
global $conf,$langs; global $conf,$langs;
@ -5156,7 +5157,12 @@ class Form
else if ($modulepart=='userphoto') else if ($modulepart=='userphoto')
{ {
$dir=$conf->user->dir_output; $dir=$conf->user->dir_output;
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
}
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email; $email=$object->email;
} }

View File

@ -3764,7 +3764,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
// TODO if object is null, load it from id and modulepart. // TODO if object is null, load it from id and modulepart.
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier'))) if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','product')))
{ {
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num); if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
@ -5118,3 +5118,32 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
return $res; return $res;
} }
/**
* Return the filename of file to get the thumbs
*
* @param string $file Original filename
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
* @param string $extImgTarget Force image format for thumbs. Use '' to keep same extension than original image.
* @return string New file name
*/
function getImageFileNameForSize($file, $extName, $extImgTarget='')
{
$dirName = dirname($file);
if ($dirName == '.') $dirName='';
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
$fileName = basename($fileName);
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i',$file)?'.gif':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.png$/i',$file)?'.png':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i',$file)?'.bmp':'');
if (! $extImgTarget) return $file;
$subdir='';
if ($extName) $subdir = 'thumbs/';
return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
}

View File

@ -337,7 +337,6 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source' && ! is_object($sourcecompany)) return -1; if ($mode == 'source' && ! is_object($sourcecompany)) return -1;
if ($mode == 'target' && ! is_object($targetcompany)) return -1; if ($mode == 'target' && ! is_object($targetcompany)) return -1;
if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1;
if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO: Deprecated if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO: Deprecated
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id); if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
@ -1198,7 +1197,10 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlinenum',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1224,7 +1226,10 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineref',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1249,7 +1254,10 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineref_supplier',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1276,7 +1284,8 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1306,7 +1315,8 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1331,10 +1341,10 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $modules) $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
{ $action='';
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails); $reshook = $hookmanager->executeHooks('pdf_getlineupwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
} return $hookmanager->resPrint;
} }
else else
{ {
@ -1363,7 +1373,8 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1393,7 +1404,8 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1423,7 +1435,8 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1453,7 +1466,8 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1488,8 +1502,8 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
'special_code' => $special_code 'special_code' => $special_code
); );
$action = ''; $action = '';
return $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$action); // Note that $action and $object may have been modified by some hooks return $hookmanager->resPrint;
} else { } else {
if (empty($hidedetails) || $hidedetails > 1) { if (empty($hidedetails) || $hidedetails > 1) {
return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short')); return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
@ -1522,7 +1536,8 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1549,7 +1564,8 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = ''; $action = '';
return $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} else { } else {
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%'; if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%';
} }
@ -1584,7 +1600,8 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1619,7 +1636,8 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
return $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else else
{ {
@ -1657,7 +1675,10 @@ function pdf_getTotalQty($object,$type,$outputlangs)
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getTotalQty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} }
else if ($type==0 && $object->lines[$i]->product_type == 0) else if ($type==0 && $object->lines[$i]->product_type == 0)
{ {

View File

@ -91,7 +91,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
if (! $passok) if (! $passok)
{ {
if ((! $passcrypted || $passtyped) if ((! $passcrypted || $passtyped)
&& ($passtyped == $passclear)) && ($passclear && ($passtyped == $passclear)))
{ {
$passok=true; $passok=true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database"); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database");

View File

@ -191,7 +191,7 @@ class pdf_crabe extends ModelePDFFactures
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product); $objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,'product') . $object->lines[$i]->fk_product ."/photos/"; $pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
$realpath=''; $realpath='';

View File

@ -300,8 +300,8 @@ class modProjet extends DolibarrModules
} }
} }
// End add extra fields // End add extra fields
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote")); $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time")); $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Francis Appels <francis.appels@yahoo.com> * Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1002,7 +1002,7 @@ class Expedition extends CommonObject
} }
} }
/** /**
* Delete shipment. * Delete shipment.
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
* *
@ -1011,9 +1011,13 @@ class Expedition extends CommonObject
function delete() function delete()
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($conf->productbatch->enabled)
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
}
$error=0; $error=0;
$this->error='';
// Add a protection to refuse deleting if shipment has at least one delivery // Add a protection to refuse deleting if shipment has at least one delivery
$this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
@ -1024,15 +1028,6 @@ class Expedition extends CommonObject
} }
$this->db->begin(); $this->db->begin();
if ($conf->productbatch->enabled)
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
if (ExpeditionLineBatch::deletefromexp($this->db,$this->id) < 0)
{
$error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
// Stock control // Stock control
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > 0) if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > 0)
{ {
@ -1041,7 +1036,7 @@ class Expedition extends CommonObject
$langs->load("agenda"); $langs->load("agenda");
// Loop on each product line to add a stock movement // Loop on each product line to add a stock movement
$sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot"; $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid as expeditiondet_id";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
$sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " WHERE ed.fk_expedition = ".$this->id;
@ -1057,22 +1052,58 @@ class Expedition extends CommonObject
dol_syslog(get_class($this)."::delete movement index ".$i); dol_syslog(get_class($this)."::delete movement index ".$i);
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db); $mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this; // we do not log origin because it will be deleted
// We decrement stock of product (and sub-products) $mouvS->origin = null;
// We use warehouse selected for each line // get lot/serial
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr",$this->ref)); $lotArray = null;
if ($result < 0) if ($conf->productbatch->enabled)
{ {
$error++; $lotArray = ExpeditionLineBatch::fetchAll($this->db,$obj->expeditiondet_id);
break; if (! is_array($lotArray))
{
$error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
if (empty($lotArray)) {
// no lot/serial
// We increment stock of product (and sub-products)
// We use warehouse selected for each line
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr", $this->ref));
if ($result < 0)
{
$error++;$this->errors=$this->errors + $mouvS->errors;
break;
}
}
else
{
// We increment stock of batches
// We use warehouse selected for each line
foreach($lotArray as $lot)
{
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->dluo_qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch);
if ($result < 0)
{
$error++;$this->errors=$this->errors + $mouvS->errors;
break;
}
}
} }
} }
} }
else else
{ {
$error++; $error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
// delete batch expedition line
if (! $error && $conf->productbatch->enabled)
{
if (ExpeditionLineBatch::deletefromexp($this->db,$this->id) < 0)
{
$error++;$this->errors[]="Error ".$this->db->lasterror();
} }
} }
@ -1094,13 +1125,13 @@ class Expedition extends CommonObject
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('SHIPPING_DELETE',$user); $result=$this->call_trigger('SHIPPING_DELETE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
// We delete PDFs // We delete PDFs
@ -1127,8 +1158,8 @@ class Expedition extends CommonObject
} }
return 1; return 1;
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;

View File

@ -189,11 +189,12 @@ class ExpeditionLineBatch extends CommonObject
$sql.= " WHERE fk_expeditiondet=".(int) $id_line_expdet; $sql.= " WHERE fk_expeditiondet=".(int) $id_line_expdet;
dol_syslog(__METHOD__ ."", LOG_DEBUG); dol_syslog(__METHOD__ ."", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num=$db->num_rows($resql); $num=$db->num_rows($resql);
$i=0; $i=0;
$ret = array();
while ($i<$num) while ($i<$num)
{ {
$tmp=new self($db); $tmp=new self($db);

View File

@ -1543,7 +1543,7 @@ class ExpenseReport extends CommonObject
$response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24; $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24;
$response->label=$langs->trans("ExpenseReportsToPay"); $response->label=$langs->trans("ExpenseReportsToPay");
$response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&amp;statut=5'; $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&amp;statut=5';
$response->img=img_object($langs->trans("ExpenseReports"),"user"); $response->img=img_object($langs->trans("ExpenseReports"),"trip");
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {

View File

@ -123,7 +123,7 @@ print '<td align="right">'.$langs->trans("LibraryVersion").'</td>';
print '</tr>'; print '</tr>';
include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php';
$model=new ModeleExports(); $model=new ModeleExports($db);
$liste=$model->liste_modeles($db); // This is not a static method for exports because method load non static properties $liste=$model->liste_modeles($db); // This is not a static method for exports because method load non static properties
$var=true; $var=true;

View File

@ -72,11 +72,19 @@ if ($id > 0 || ! empty($ref))
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
print '<td colspan="2">'.$object->ref.'</td>';
$nbrow=4; // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td></tr>';
$nbrow=3;
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$soc->id.'">'.$soc->name.'</a>';
print '</td>';
print '<td rowspan="'.$nbrow.'" valign="top" width="50%">'; print '<td rowspan="'.$nbrow.'" valign="top" width="50%">';
/* /*
@ -124,7 +132,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n"; print "</table>\n";
// Conversion du PDF en image png si fichier png non existant // Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis)) if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{ {
if (class_exists("Imagick")) if (class_exists("Imagick"))
{ {
@ -141,21 +149,14 @@ if ($id > 0 || ! empty($ref))
print "</td></tr>"; print "</td></tr>";
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$soc->id.'">'.$soc->name.'</a>';
print '</td>';
print '</tr>';
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td>'; print '<tr><td>'.$langs->trans("Status").'</td>';
print "<td colspan=\"2\">".$object->getLibStatut(4)."</td>\n"; print "<td>".$object->getLibStatut(4)."</td>\n";
print '</tr>'; print '</tr>';
// Date // Date
print '<tr><td>'.$langs->trans("Date").'</td>'; print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td colspan=\"2\">".dol_print_date($object->datec,"daytext")."</td>\n"; print "<td>".dol_print_date($object->datec,"daytext")."</td>\n";
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';

View File

@ -30,7 +30,7 @@
* \brief File that include conf.php file and commons lib like functions.lib.php * \brief File that include conf.php file and commons lib like functions.lib.php
*/ */
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.8.1'); if (! defined('DOL_VERSION')) define('DOL_VERSION','3.8.2');
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -337,7 +337,7 @@ if ($object->id > 0)
//Query from product/liste.php //Query from product/liste.php
$sql = 'SELECT p.rowid, p.ref, p.label, pfp.tms,'; $sql = 'SELECT p.rowid, p.ref, p.label, pfp.tms,';
$sql.= ' p.fk_product_type'; $sql.= ' p.fk_product_type, p.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
@ -361,6 +361,7 @@ if ($object->id > 0)
$productstatic->ref = $objp->ref; $productstatic->ref = $objp->ref;
$productstatic->label = $objp->label; $productstatic->label = $objp->label;
$productstatic->type = $objp->fk_product_type; $productstatic->type = $objp->fk_product_type;
$productstatic->entity = $objp->entity;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td class="nowrap">'; print '<td class="nowrap">';

View File

@ -460,6 +460,7 @@ class CommandeFournisseur extends CommonOrder
{ {
$result = 1; $result = 1;
$this->log($user, 1, time()); // Statut 1 $this->log($user, 1, time()); // Statut 1
$this->statut = 1;
$this->ref = $num; $this->ref = $num;
} }
@ -1570,6 +1571,7 @@ class CommandeFournisseur extends CommonOrder
$result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user); $result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user);
if ($result < 0) if ($result < 0)
{ {
$this->errors[]='ErrorWhenRunningTrigger';
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
return -1; return -1;
} }
@ -1582,6 +1584,8 @@ class CommandeFournisseur extends CommonOrder
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++; $error++;
} }
@ -1592,12 +1596,14 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->affected_rows($resql) < 1) if ($this->db->affected_rows($resql) < 1)
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++; $error++;
} }
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++; $error++;
} }
@ -1607,6 +1613,8 @@ class CommandeFournisseur extends CommonOrder
$result=$this->deleteExtraFields(); $result=$this->deleteExtraFields();
if ($result < 0) if ($result < 0)
{ {
$this->error='FailToDeleteExtraFields';
$this->errors[]='FailToDeleteExtraFields';
$error++; $error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
} }
@ -1614,7 +1622,11 @@ class CommandeFournisseur extends CommonOrder
// Delete linked object // Delete linked object
$res = $this->deleteObjectLinked(); $res = $this->deleteObjectLinked();
if ($res < 0) $error++; if ($res < 0) {
$this->error='FailToDeleteObjectLinked';
$this->errors[]='FailToDeleteObjectLinked';
$error++;
}
if (! $error) if (! $error)
{ {
@ -1629,6 +1641,7 @@ class CommandeFournisseur extends CommonOrder
if (! dol_delete_file($file,0,0,0,$this)) // For triggers if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{ {
$this->error='ErrorFailToDeleteFile'; $this->error='ErrorFailToDeleteFile';
$this->errors[]='ErrorFailToDeleteFile';
$error++; $error++;
} }
} }
@ -1638,6 +1651,7 @@ class CommandeFournisseur extends CommonOrder
if (! $res) if (! $res)
{ {
$this->error='ErrorFailToDeleteDir'; $this->error='ErrorFailToDeleteDir';
$this->errors[]='ErrorFailToDeleteDir';
$error++; $error++;
} }
} }

View File

@ -81,7 +81,6 @@ $year = GETPOST("year","int");
$day_lim = GETPOST('day_lim','int'); $day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int'); $month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int'); $year_lim = GETPOST('year_lim','int');
$filter = GETPOST("filtre");
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers
{ {
@ -91,9 +90,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_company=""; $search_company="";
$search_amount_no_tax=""; $search_amount_no_tax="";
$search_amount_all_tax=""; $search_amount_all_tax="";
$search_status="";
$year=""; $year="";
$month=""; $month="";
$filter="";
} }
/* /*
@ -147,15 +146,6 @@ if ($socid)
{ {
$sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = ".$socid;
} }
if ($filter && $filter != -1) // GETPOST('filtre') may be a string
{
$filtrearr = explode(",", $filter);
foreach ($filtrearr as $fil)
{
$filt = explode(":", $fil);
$sql .= " AND " . $filt[0] . " = " . $filt[1];
}
}
if ($search_ref) if ($search_ref)
{ {
@ -214,7 +204,7 @@ if ($search_amount_all_tax != '')
if ($search_status != '') if ($search_status != '')
{ {
$sql.= " AND fac.fk_statut = '".$db->escape($search_status)."'"; $sql.= " AND fac.fk_statut = ".$search_status;
} }
$nbtotalofrecords = 0; $nbtotalofrecords = 0;
@ -248,7 +238,7 @@ if ($resql)
if ($search_company) $param.='&search_company='.urlencode($search_company); if ($search_company) $param.='&search_company='.urlencode($search_company);
if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax);
if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter); if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -305,8 +295,8 @@ if ($resql)
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">'; print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
$liststatus=array('fac.fk_statut:0'=>$langs->trans("Draft"),'fac.fk_statut:1,paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid")); $liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"));
print $form->selectarray('filtre', $liststatus, $filter, 1); print $form->selectarray('filtre', $liststatus, $search_status, 1);
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';

View File

@ -86,7 +86,7 @@ if ($fourn_id)
$supplier->fetch($fourn_id); $supplier->fetch($fourn_id);
} }
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type,"; $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,";
$sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; $sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,";
$sql.= " s.rowid as socid, s.nom as name"; $sql.= " s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
@ -212,6 +212,7 @@ if ($resql)
$productstatic->id=$objp->rowid; $productstatic->id=$objp->rowid;
$productstatic->ref=$objp->ref; $productstatic->ref=$objp->ref;
$productstatic->type=$objp->fk_product_type; $productstatic->type=$objp->fk_product_type;
$productstatic->entity=$objp->entity;
print $productstatic->getNomUrl(1,'supplier'); print $productstatic->getNomUrl(1,'supplier');
print '</td>'; print '</td>';

View File

@ -974,6 +974,7 @@ Delays_MAIN_DELAY_CUSTOMER_BILLS_UNPAYED=Tolerence delay (in days) before alert
Delays_MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE=Tolerance delay (in days) before alert on pending bank reconciliation Delays_MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE=Tolerance delay (in days) before alert on pending bank reconciliation
Delays_MAIN_DELAY_MEMBERS=Tolerance delay (in days) before alert on delayed membership fee Delays_MAIN_DELAY_MEMBERS=Tolerance delay (in days) before alert on delayed membership fee
Delays_MAIN_DELAY_CHEQUES_TO_DEPOSIT=Tolerance delay (in days) before alert for cheques deposit to do Delays_MAIN_DELAY_CHEQUES_TO_DEPOSIT=Tolerance delay (in days) before alert for cheques deposit to do
Delays_MAIN_DELAY_EXPENSEREPORTS=Tolerance delay (in days) before alert for expense reports to approve
SetupDescription1=All parameters available in the setup area allow you to setup Dolibarr before starting using it. SetupDescription1=All parameters available in the setup area allow you to setup Dolibarr before starting using it.
SetupDescription2=The 2 most important setup steps are the 2 first ones in the left setup menu, this means Company/foundation setup page and Modules setup page: SetupDescription2=The 2 most important setup steps are the 2 first ones in the left setup menu, this means Company/foundation setup page and Modules setup page:
SetupDescription3=Parameters in menu <a href="%s">Setup -> Company/foundation</a> are required because input information is used on Dolibarr displays and to modify Dolibarr behaviour (for example for features related to your country). SetupDescription3=Parameters in menu <a href="%s">Setup -> Company/foundation</a> are required because input information is used on Dolibarr displays and to modify Dolibarr behaviour (for example for features related to your country).
@ -1110,6 +1111,9 @@ EmptyNumRefModelDesc=The code is free. This code can be modified at any time.
##### Module password generation ##### Module password generation
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually. PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.
PasswordGenerationPerso=Return a password according to your personally defined configuration.
SetupPerso=According to your configuration
PasswordPatternDesc=Password pattern description
##### Users setup ##### ##### Users setup #####
UserGroupSetup=Users and groups module setup UserGroupSetup=Users and groups module setup
GeneratePassword=Suggest a generated password GeneratePassword=Suggest a generated password

View File

@ -175,6 +175,7 @@ ProjectWeightedOppAmountOfProjectsByMonth=Weighted amount of opportunities by mo
ProjectOpenedProjectByOppStatus=Opened project/lead by opportunity status ProjectOpenedProjectByOppStatus=Opened project/lead by opportunity status
ProjectsStatistics=Statistics on projects/leads ProjectsStatistics=Statistics on projects/leads
TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible. TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible.
IdTaskTime=Id task time
OpenedProjectsByThirdparties=Opened projects by thirdparties OpenedProjectsByThirdparties=Opened projects by thirdparties
OpportunityTotalAmount=Opportunities total amount OpportunityTotalAmount=Opportunities total amount
OpportunityPonderatedAmount=Opportunities weighted amount OpportunityPonderatedAmount=Opportunities weighted amount

View File

@ -3,9 +3,9 @@ WorkflowSetup=Workflow module setup
WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in. WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in.
ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules. ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules.
descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed
descWORKFLOW_PROPAL_AUTOCREATE_INVOICEAutomatically create a customer invoice after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICEAutomatically create a customer invoice after a contract is validated descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated
descWORKFLOW_ORDER_AUTOCREATE_INVOICEAutomatically create a customer invoice after a customer order is closed descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a customer order is closed
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated

View File

@ -1443,7 +1443,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
// User photo // User photo
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem" style="padding: 0px;">'; $toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem" style="padding: 0px;">';
$toprightmenu.=$user->getPhotoUrl(16,16,'loginphoto'); $toprightmenu.=$user->getPhotoUrl(16,16,'loginphoto','mini');
$toprightmenu.='</div></div>'; $toprightmenu.='</div></div>';
// Login name with tooltip // Login name with tooltip

View File

@ -162,7 +162,7 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) {
print "</table>"; print "</table>";
print '</form>'; print '</form>';
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref,"; $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " d.fk_product,";
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
$sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(d.total_ht) as selling_price,";
@ -264,6 +264,7 @@ if ($result)
$product_static->id=$objp->rowid; $product_static->id=$objp->rowid;
$product_static->ref=$objp->ref; $product_static->ref=$objp->ref;
$product_static->label=$objp->label; $product_static->label=$objp->label;
$product_static->entity=$objp->pentity;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
print $text.= ' - '.$objp->label; print $text.= ' - '.$objp->label;
print "</td>\n"; print "</td>\n";

View File

@ -341,7 +341,7 @@ class ActionsCardProduct
$sql = 'SELECT DISTINCT '; $sql = 'SELECT DISTINCT ';
// Fields requiered // Fields requiered
$sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte'; $sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte, p.entity';
// Fields not requiered // Fields not requiered
foreach($this->field_list as $field) foreach($this->field_list as $field)
@ -417,6 +417,7 @@ class ActionsCardProduct
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->$alias; $this->ref = $obj->$alias;
$this->type = $obj->fk_product_type; $this->type = $obj->fk_product_type;
$this->entity = $obj->entity;
$datas[$alias] = $this->getNomUrl(1,'',24); $datas[$alias] = $this->getNomUrl(1,'',24);
} }
else if ($alias == 'stock') else if ($alias == 'stock')

View File

@ -2768,7 +2768,8 @@ class Product extends CommonObject
'type'=>$type, // Nb of units that compose parent product 'type'=>$type, // Nb of units that compose parent product
'desiredstock'=>$this->desiredstock, 'desiredstock'=>$this->desiredstock,
'level'=>$level, 'level'=>$level,
'incdec'=>$incdec 'incdec'=>$incdec,
'entity'=>$this->entity
); );
// Recursive call if there is childs to child // Recursive call if there is childs to child
@ -2850,7 +2851,7 @@ class Product extends CommonObject
*/ */
function getFather() function getFather()
{ {
$sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec"; $sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec, p.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,";
$sql.= " ".MAIN_DB_PREFIX."product as p"; $sql.= " ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.rowid = pa.fk_product_pere"; $sql.= " WHERE p.rowid = pa.fk_product_pere";
@ -2868,6 +2869,7 @@ class Product extends CommonObject
$prods[$record['id']]['qty'] = $record['qty']; $prods[$record['id']]['qty'] = $record['qty'];
$prods[$record['id']]['incdec'] = $record['incdec']; $prods[$record['id']]['incdec'] = $record['incdec'];
$prods[$record['id']]['fk_product_type'] = $record['fk_product_type']; $prods[$record['id']]['fk_product_type'] = $record['fk_product_type'];
$prods[$record['id']]['entity'] = $record['entity'];
} }
return $prods; return $prods;
} }
@ -3976,12 +3978,14 @@ class Product extends CommonObject
// Process // Process
foreach($to_del as $del) { foreach($to_del as $del) {
$c->fetch($del); if ($c->fetch($del) > 0) {
$c->del_type($this, 'product'); $c->del_type($this, 'product');
}
} }
foreach ($to_add as $add) { foreach ($to_add as $add) {
$c->fetch($add); if ($c->fetch($add) > 0) {
$c->add_type($this, 'product'); $c->add_type($this, 'product');
}
} }
return; return;

View File

@ -139,7 +139,7 @@ if ($action == 'search')
{ {
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem'; $sql.= ' p.fk_product_type, p.tms as datem';
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm'; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
@ -278,6 +278,7 @@ if ($id > 0 || ! empty($ref))
$productstatic->type=$value["fk_product_type"]; $productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref']; $productstatic->ref=$value['ref'];
$productstatic->label=$value['label']; $productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
$class=($class=='impair')?'pair':'impair'; $class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">'; print '<tr class="'.$class.'">';
@ -334,6 +335,7 @@ if ($id > 0 || ! empty($ref))
$productstatic->id=$value['id']; $productstatic->id=$value['id'];
$productstatic->type=$value['type']; $productstatic->type=$value['type'];
$productstatic->label=$value['label']; $productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
if ($value['level'] <= 1) if ($value['level'] <= 1)
{ {
@ -542,6 +544,7 @@ if ($id > 0 || ! empty($ref))
$productstatic->ref=$objp->ref; $productstatic->ref=$objp->ref;
$productstatic->label=$objp->label; $productstatic->label=$objp->label;
$productstatic->type=$objp->type; $productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
print '<td>'.$productstatic->getNomUrl(1,'',24).'</td>'; print '<td>'.$productstatic->getNomUrl(1,'',24).'</td>';
$labeltoshow=$objp->label; $labeltoshow=$objp->label;

View File

@ -70,8 +70,10 @@ if ($id > 0 || ! empty($ref))
{ {
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/';
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/';
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $upload_dir.= get_exdir($object->id,2,0,0,$object,'product').$object->id."/photos";
else $upload_dir.= dol_sanitizeFileName($object->ref);
} }
$modulepart='produit'; $modulepart='produit';

View File

@ -314,7 +314,8 @@ if ($result)
} }
} }
print '<td align="right">'; print '<td align="right">';
print price($objp->price).' '.$langs->trans("HT"); if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
else print price($objp->price).' '.$langs->trans("HT");
print '</td>'; print '</td>';
} }
print '<td align="right" class="nowrap">'; print '<td align="right" class="nowrap">';

View File

@ -133,7 +133,7 @@ else
// Add what we are searching for // Add what we are searching for
if (! empty($sall)) $texte.= " - ".$sall; if (! empty($sall)) $texte.= " - ".$sall;
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' MIN(pfp.unitprice) as minsellprice'; $sql.= ' MIN(pfp.unitprice) as minsellprice';
@ -431,6 +431,7 @@ else
$product_static->ref = $objp->ref; $product_static->ref = $objp->ref;
$product_static->label = $objp->label; $product_static->label = $objp->label;
$product_static->type = $objp->fk_product_type; $product_static->type = $objp->fk_product_type;
$product_static->entity = $objp->entity;
print $product_static->getNomUrl(1,'',24); print $product_static->getNomUrl(1,'',24);
print "</td>\n"; print "</td>\n";

View File

@ -101,7 +101,7 @@ $htmlother=new FormOther($db);
$title=$langs->trans("ProductsAndServices"); $title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' SUM(s.reel) as stock_physique'; $sql.= ' SUM(s.reel) as stock_physique';
@ -307,6 +307,7 @@ if ($resql)
$product_static->id=$objp->rowid; $product_static->id=$objp->rowid;
$product_static->label = $objp->label; $product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
print $product_static->getNomUrl(1,'',16); print $product_static->getNomUrl(1,'',16);
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>'; print '</td>';

View File

@ -104,7 +104,7 @@ $htmlother=new FormOther($db);
$title=$langs->trans("ProductsAndServices"); $title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' s.fk_entrepot,'; $sql.= ' s.fk_entrepot,';
@ -324,6 +324,7 @@ if ($resql)
$product_static->id=$objp->rowid; $product_static->id=$objp->rowid;
$product_static->label = $objp->label; $product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
print $product_static->getNomUrl(1,'',16); print $product_static->getNomUrl(1,'',16);
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>'; print '</td>';

View File

@ -128,9 +128,9 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->commande->lire) if ($user->rights->commande->lire)
{ {
$sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,";
$sql .= " c.ref_client,"; $sql .= " c.ref_client,";
$sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."commande as c";

View File

@ -135,9 +135,9 @@ if ($id > 0 || ! empty($ref)) {
print '</div>'; print '</div>';
if ($user->rights->fournisseur->commande->lire) { if ($user->rights->fournisseur->commande->lire) {
$sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
$sql .= " c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.rowid, d.total_ht as total_ht, c.ref,";
$sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.rowid, d.qty";
if (! $user->rights->societe->client->voir && ! $socid) if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", sc.fk_soc, sc.fk_user "; $sql .= ", sc.fk_soc, sc.fk_user ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";

View File

@ -128,10 +128,11 @@ if ($id > 0 || ! empty($ref))
print '</div>'; print '</div>';
if ($user->rights->facture->lire) { if ($user->rights->facture->lire)
$sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; {
$sql.= " f.facnumber, d.total_ht as total_ht,"; $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; $sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facture as f";
@ -147,24 +148,27 @@ if ($id > 0 || ! empty($ref))
$sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')'; $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')';
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->order($sortfield, $sortorder);
//Calcul total qty and amount for global if full scan list //Calcul total qty and amount for global if full scan list
$total_ht=0; $total_ht=0;
$total_qty=0; $total_qty=0;
$totalrecords=0; $totalrecords=0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$totalrecords = $db->num_rows($result); $totalrecords = $db->num_rows($result);
while ($objp = $db->fetch_object($result)) { while ($objp = $db->fetch_object($result))
{
$total_ht+=$objp->total_ht; $total_ht+=$objp->total_ht;
$total_qty+=$objp->qty; $total_qty+=$objp->qty;
} }
} }
} }
$sql.= $db->plimit($conf->liste_limit +1, $offset); $sql.= $db->plimit($conf->liste_limit + 1, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -214,7 +218,7 @@ if ($id > 0 || ! empty($ref))
if ($num > 0) if ($num > 0)
{ {
$var=True; $var=True;
while ($i < $num && $i < $conf->liste_limit) while ($i < min($num,$conf->liste_limit))
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;

View File

@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, d.total_ht as total_ht,"; $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, f.ref, d.rowid, d.total_ht as total_ht,";
$sql .= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; $sql .= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty";
if (! $user->rights->societe->client->voir && ! $socid) if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", sc.fk_soc, sc.fk_user "; $sql .= ", sc.fk_soc, sc.fk_user ";

View File

@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->propale->lire) { if ($user->rights->propale->lire) {
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,";
$sql .= " p.ref_client,"; $sql .= " p.ref_client,";
$sql .= "p.datep, p.fk_statut as statut, d.qty"; $sql .= "p.datep, p.fk_statut as statut, d.rowid, d.qty";
if (! $user->rights->societe->client->voir && ! $socid) if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", sc.fk_soc, sc.fk_user "; $sql .= ", sc.fk_soc, sc.fk_user ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";

View File

@ -394,7 +394,7 @@ else
$totalunit=0; $totalunit=0;
$totalvalue=$totalvaluesell=0; $totalvalue=$totalvaluesell=0;
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,"; $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
$sql.= " ps.pmp, ps.reel as value"; $sql.= " ps.pmp, ps.reel as value";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE ps.fk_product = p.rowid"; $sql.= " WHERE ps.fk_product = p.rowid";
@ -438,6 +438,7 @@ else
$productstatic->ref = $objp->ref; $productstatic->ref = $objp->ref;
$productstatic->label = $objp->produit; $productstatic->label = $objp->produit;
$productstatic->type=$objp->type; $productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
print $productstatic->getNomUrl(1,'stock',16); print $productstatic->getNomUrl(1,'stock',16);
print '</td>'; print '</td>';
print '<td>'.$objp->produit.'</td>'; print '<td>'.$objp->produit.'</td>';

View File

@ -135,14 +135,14 @@ class Entrepot extends CommonObject
*/ */
function update($id, $user) function update($id, $user)
{ {
$this->libelle=$this->db->escape(trim($this->libelle)); $this->libelle=trim($this->libelle);
$this->description=$this->db->escape(trim($this->description)); $this->description=trim($this->description);
$this->lieu=$this->db->escape(trim($this->lieu)); $this->lieu=trim($this->lieu);
$this->address=$this->db->escape(trim($this->address)); $this->address=trim($this->address);
$this->zip=$this->zip?trim($this->zip):trim($this->zip); $this->zip=trim($this->zip);
$this->town=$this->town?trim($this->town):trim($this->town); $this->town=trim($this->town);
$this->country_id=($this->country_id > 0 ? $this->country_id : $this->country_id); $this->country_id=($this->country_id > 0 ? $this->country_id : $this->country_id);
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";

View File

@ -164,7 +164,7 @@ $form=new Form($db);
$formother=new FormOther($db); $formother=new FormOther($db);
$formproduct=new FormProduct($db); $formproduct=new FormProduct($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type,"; $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type, p.entity,";
$sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,"; $sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; $sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch,m.eatby,m.sellby,"; $sql.= " m.batch,m.eatby,m.sellby,";
@ -575,6 +575,7 @@ if ($resql)
$productstatic->ref=$objp->product_ref; $productstatic->ref=$objp->product_ref;
$productstatic->label=$objp->produit; $productstatic->label=$objp->produit;
$productstatic->type=$objp->type; $productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
print $productstatic->getNomUrl(1,'',16); print $productstatic->getNomUrl(1,'',16);
print "</td>\n"; print "</td>\n";
// Product label // Product label

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -46,7 +46,7 @@ if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
$nblignes=$object->fetch_lines(); $nblignes=$object->fetch_lines();
//If the survey has not yet finished, then it can be modified //If the survey has not yet finished, then it can be modified
$canbemodified = ($object->date_fin > dol_now()); $canbemodified = (empty($object->date_fin) || $object->date_fin > dol_now());
/* /*

View File

@ -2468,6 +2468,7 @@ class Societe extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->parent = $id;
return 1; return 1;
} }
else else
@ -3395,12 +3396,14 @@ class Societe extends CommonObject
// Process // Process
foreach ($to_del as $del) { foreach ($to_del as $del) {
$c->fetch($del); if ($c->fetch($del) > 0) {
$c->del_type($this, $type_text); $c->del_type($this, $type_text);
}
} }
foreach ($to_add as $add) { foreach ($to_add as $add) {
$c->fetch($add); if ($c->fetch($add) > 0) {
$c->add_type($this, $type_text); $c->add_type($this, $type_text);
}
} }
return; return;

View File

@ -285,7 +285,7 @@ $sql = $sql_select;
$sql.= ' d.description as description,'; $sql.= ' d.description as description,';
if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,';
if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,';
if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type,'; if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,';
$sql.= " s.rowid as socid "; $sql.= " s.rowid as socid ";
if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from;
@ -402,6 +402,7 @@ if ($sql_select)
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product; $product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref; $product_static->ref=$objp->ref;
$product_static->entity=$objp->pentity;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
} }

View File

@ -649,6 +649,7 @@ if (empty($reshook))
// Set parent company // Set parent company
if ($action == 'set_thirdparty' && $user->rights->societe->creer) if ($action == 'set_thirdparty' && $user->rights->societe->creer)
{ {
$object->fetch($socid);
$result = $object->set_parent(GETPOST('editparentcompany','int')); $result = $object->set_parent(GETPOST('editparentcompany','int'));
} }

View File

@ -1813,14 +1813,15 @@ class User extends CommonObject
* @param int $width Width of image * @param int $width Width of image
* @param int $height Height of image * @param int $height Height of image
* @param string $cssclass Force a css class * @param string $cssclass Force a css class
* @param string $imagesize 'mini', 'small' or '' (original)
* @return string String with URL link * @return string String with URL link
*/ */
function getPhotoUrl($width, $height, $cssclass='') function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
{ {
$result=''; $result='';
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; $result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass); $result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
$result.='</a>'; $result.='</a>';
return $result; return $result;