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

This commit is contained in:
fappels 2017-02-03 11:37:39 +01:00
commit 76bd5e009a
99 changed files with 841 additions and 571 deletions

View File

@ -150,11 +150,31 @@ Dolibarr better:
- A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters, - A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters,
no more required, were also removed. Use this new one if you were using one of them. no more required, were also removed. Use this new one if you were using one of them.
- The trigger that activate or close a contract line is run on a contract line, not on contract. - The trigger that activate or close a contract line is run on a contract line, not on contract.
- Method commande->set_availability(user, availability_id) removed from commande class, use method commande->availability(availability_id, notrigger).
Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough
feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
***** ChangeLog for 4.0.4 to 4.0.3 *****
FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
FIX: #6230
FIX: #6237
FIX: #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page
FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter
FIX: #6277
FIX: project list and ajax completion return wrong list.
FIX: bug margin calculation by user with multicompany
FIX: Can make a stock transfert on product not on sale/purchase.
FIX: extrafield input for varchar was not working with special char within (ie double quotes)
FIX: javascript error
FIX: link for not found photo when using gravatar. Must use external url.
FIX: Protection so even if link is output for external user, links is disabled.
FIX: repair tool was ko to restore extrafields with type select.
FIX: Security access problem with external users on projects/tasks
FIX: We must not drop extrafield column if there is still record on other entities.
FIX: regression with sedning email when introducing security options to restrict nb of email sending.
t
***** ChangeLog for 4.0.3 to 4.0.2 ***** ***** ChangeLog for 4.0.3 to 4.0.2 *****
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
FIX: #5958 no discount on supplier command made by replenishment FIX: #5958 no discount on supplier command made by replenishment

View File

@ -174,7 +174,7 @@ then
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
else else
echo Detection of documents directory $documentdir failed so demo files were not copied. echo Detection of documents directory from $mydir failed so demo files were not copied.
fi fi

View File

@ -86,14 +86,14 @@ $idpays = $p[0];
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,"; $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation,"; $sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation,";
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_code,"; $sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
$sql .= " f.accountancy_code, ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " f.accountancy_code, ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_valid"; $sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
$sql .= " WHERE er.fk_statut > 0 "; $sql .= " WHERE er.fk_statut > 0 ";
$sql .= " AND erd.fk_code_ventilation > 0 "; $sql .= " AND erd.fk_code_ventilation > 0 ";
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy

View File

@ -194,7 +194,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
* Fact bookmark mode or visually edition * Fact bookmark mode or visually edition
*/ */
$object->fetch($id); $object->fetch($id);
$hselected = 'card'; $hselected = 'card';
$head = array( $head = array(
array( array(
@ -216,10 +216,10 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
$linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0);
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -307,7 +307,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
// Buttons // Buttons
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
// Edit // Edit

View File

@ -602,6 +602,29 @@ if (empty($reshook))
} }
} }
// Action confirmation validation
if ($action == 'confirm_settodraft' && $confirm == 'yes')
{
if ($object->id > 0)
{
$result = $object->setStatut(0);
if ($result > 0)
{
//setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
dol_print_error($db);
}
}
// Resend // Resend
if ($action == 'confirm_reset' && $confirm == 'yes') if ($action == 'confirm_reset' && $confirm == 'yes')
{ {
@ -707,7 +730,7 @@ if ($action == 'create')
print '<div style="padding-top: 10px">'; print '<div style="padding-top: 10px">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create(); $doleditor->Create();
print '</div>'; print '</div>';
@ -727,7 +750,12 @@ else
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email'); dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
// Confirmation de la validation du mailing // Confirmation back to draft
if ($action == 'settodraft')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("SetToDraft"),$langs->trans("ConfirmUnvalidateEmailing"),"confirm_settodraft",'','',1);
}
// Confirmation validation of mailing
if ($action == 'valid') if ($action == 'valid')
{ {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1);
@ -900,10 +928,15 @@ else
* Boutons d'action * Boutons d'action
*/ */
if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('valid','delete','sendall','clone'))) if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone')))
{ {
print "\n\n<div class=\"tabsAction\">\n"; print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id))
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&amp;id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
}
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditMailing").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
@ -1065,7 +1098,7 @@ else
$readonly=1; $readonly=1;
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly); $doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
$doleditor->Create(); $doleditor->Create();
} }
else print dol_htmlentitiesbr($object->body); else print dol_htmlentitiesbr($object->body);
@ -1212,7 +1245,7 @@ else
print '<div style="padding-top: 10px">'; print '<div style="padding-top: 10px">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create(); $doleditor->Create();
print '</div>'; print '</div>';

View File

@ -533,7 +533,7 @@ if ($object->fetch($id) >= 0)
print '<td align="center">'; print '<td align="center">';
if (empty($obj->source_id) || empty($obj->source_type)) if (empty($obj->source_id) || empty($obj->source_type))
{ {
print $obj->source_url; // For backward compatibility print empty($obj->source_url)?'':$obj->source_url; // For backward compatibility
} }
else else
{ {

View File

@ -601,35 +601,38 @@ class Mailing extends CommonObject
if ($mode == 2) if ($mode == 2)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
} }
if ($mode == 5) if ($mode == 5)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
}
if ($mode == 6)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
} }
} }
} }

View File

@ -174,7 +174,7 @@ if ($result)
{ {
print '<td align="center">'; print '<td align="center">';
$nbemail = $obj->nbemail; $nbemail = $obj->nbemail;
if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) /*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
{ {
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->textwithpicto($nbemail,$text,1,'warning'); print $form->textwithpicto($nbemail,$text,1,'warning');
@ -182,7 +182,8 @@ if ($result)
else else
{ {
print $nbemail; print $nbemail;
} }*/
print $nbemail;
print '</td>'; print '</td>';
} }
// Last send // Last send

View File

@ -2764,6 +2764,8 @@ class Propal extends CommonObject
*/ */
function availability($availability_id, $notrigger=0) function availability($availability_id, $notrigger=0)
{ {
global $user;
if ($this->statut >= self::STATUS_DRAFT) if ($this->statut >= self::STATUS_DRAFT)
{ {
$error=0; $error=0;

View File

@ -242,7 +242,8 @@ class Commande extends CommonOrder
} }
else else
{ {
dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); $this->error=$obj->error;
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return ""; return "";
} }
} }

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com> * Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@ -773,7 +774,7 @@ if ($resql)
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'balance','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))

View File

@ -804,14 +804,14 @@ if (empty($reshook))
$line->fk_parent_line = $fk_parent_line; $line->fk_parent_line = $fk_parent_line;
$line->subprice =-$line->subprice; // invert price for object $line->subprice =-$line->subprice; // invert price for object
$line->pa_ht = -$line->pa_ht; $line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here
$line->total_ht=-$line->total_ht; $line->total_ht=-$line->total_ht;
$line->total_tva=-$line->total_tva; $line->total_tva=-$line->total_tva;
$line->total_ttc=-$line->total_ttc; $line->total_ttc=-$line->total_ttc;
$line->total_localtax1=-$line->total_localtax1; $line->total_localtax1=-$line->total_localtax1;
$line->total_localtax2=-$line->total_localtax2; $line->total_localtax2=-$line->total_localtax2;
$result = $line->insert(); $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
$object->lines[] = $line; // insert new line in current object $object->lines[] = $line; // insert new line in current object

View File

@ -1277,7 +1277,7 @@ class Facture extends CommonInvoice
{ {
$this->lines=array(); $this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql.= ' l.situation_percent, l.fk_prev_id,'; $sql.= ' l.situation_percent, l.fk_prev_id,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,'; $sql.= ' l.rang, l.special_code,';
@ -1304,6 +1304,7 @@ class Facture extends CommonInvoice
$line->id = $objp->rowid; $line->id = $objp->rowid;
$line->rowid = $objp->rowid; // deprecated $line->rowid = $objp->rowid; // deprecated
$line->fk_facture = $objp->fk_facture;
$line->label = $objp->custom_label; // deprecated $line->label = $objp->custom_label; // deprecated
$line->desc = $objp->description; // Description line $line->desc = $objp->description; // Description line
$line->description = $objp->description; // Description line $line->description = $objp->description; // Description line
@ -1558,6 +1559,18 @@ class Facture extends CommonInvoice
$facligne->rang=-1; $facligne->rang=-1;
$facligne->info_bits=2; $facligne->info_bits=2;
// Get buy/cost price of invoice that is source of discount
if ($remise->fk_facture_source > 0)
{
$srcinvoice=new Facture($this->db);
$srcinvoice->fetch($remise->fk_facture_source);
$totalcostpriceofinvoice=0;
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; // TODO Move this into commonobject
$formmargin=new FormMargin($this->db);
$arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false);
$facligne->pa_ht = $arraytmp['pa_total'];
}
$facligne->total_ht = -$remise->amount_ht; $facligne->total_ht = -$remise->amount_ht;
$facligne->total_tva = -$remise->amount_tva; $facligne->total_tva = -$remise->amount_tva;
$facligne->total_ttc = -$remise->amount_ttc; $facligne->total_ttc = -$remise->amount_ttc;
@ -3238,7 +3251,8 @@ class Facture extends CommonInvoice
* set up mask. * set up mask.
*/ */
if ($mode != 'last' && !$numref) { if ($mode != 'last' && !$numref) {
dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error); $this->error=$obj->error;
//dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error);
return ""; return "";
} }
@ -4345,10 +4359,11 @@ class FactureLigne extends CommonInvoiceLine
/** /**
* Insert line into database * Insert line into database
* *
* @param int $notrigger 1 no triggers * @param int $notrigger 1 no triggers
* @return int <0 if KO, >0 if OK * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another
* @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger=0) function insert($notrigger=0, $noerrorifdiscountalreadylinked=0)
{ {
global $langs,$user,$conf; global $langs,$user,$conf;
@ -4495,13 +4510,16 @@ class FactureLigne extends CommonInvoiceLine
// Check if discount was found // Check if discount was found
if ($result > 0) if ($result > 0)
{ {
// Check if discount not already affected to another invoice // Check if discount not already affected to another invoice
if ($discount->fk_facture) if ($discount->fk_facture_line > 0)
{ {
$this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); if (empty($noerrorifdiscountalreadylinked))
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); {
$this->db->rollback(); $this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id);
return -3; dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
$this->db->rollback();
return -3;
}
} }
else else
{ {

View File

@ -983,7 +983,7 @@ if ($action == 'create')
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project; $projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
$langs->load('projects'); $langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td>'; print '<tr><td>' . $langs->trans('Project') . '</td><td>';
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, $forceaddid=0, $morecss=''); $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -45,6 +45,18 @@ $page = GETPOST('page','int');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.facnumber";
/* /*
* View * View
*/ */
@ -54,17 +66,7 @@ llxHeader();
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db); $invoicestatic=new Facture($db);
if ($page == -1) $page = 0 ; // List of requests
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.facnumber";
/*
* Liste de demandes
*/
$sql= "SELECT f.facnumber, f.rowid, f.total_ttc,"; $sql= "SELECT f.facnumber, f.rowid, f.total_ttc,";
$sql.= " s.nom as name, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
@ -83,10 +85,10 @@ if ($statut) $sql.= " AND pfd.traite = ".$statut;
$sql.= " AND pfd.fk_facture = f.rowid"; $sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe','alpha')))) if (dol_strlen(trim(GETPOST('search_societe','alpha'))))
{ {
$sql.= " AND s.nom LIKE '%".GETPOST('search_societe','alpha')."%'"; $sql.= natural_search("s.nom", 'search_societe');
} }
$sql.= " ORDER BY $sortfield $sortorder "; $sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -103,26 +105,35 @@ if ($resql)
print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
} }
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Bill").'</td><td class="liste_titre">'.$langs->trans("Company").'</td>'; print_liste_field_titre($langs->trans("Bill"));
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>'; print_liste_field_titre($langs->trans("Company"));
print '<td class="liste_titre" align="right">'.$langs->trans("DateRequest").'</td>'; print_liste_field_titre($langs->trans("Amount"));
print_liste_field_titre($langs->trans("DateRequest"));
print_liste_field_titre('');
print '</tr>'; print '</tr>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag(GETPOST('search_facture','alpha')).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag(GETPOST('search_facture','alpha')).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag(GETPOST('search_societe','alpha')).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag(GETPOST('search_societe','alpha')).'"></td>';
print '<td colspan="2" class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpitco;
print '</td>';
print '</tr>'; print '</tr>';
print '</form>';
$var = True; $var = True;
$users = array(); $users = array();
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
@ -145,12 +156,15 @@ if ($resql)
print '<td align="right">'.dol_print_date($db->jdate($obj->date_demande),'day').'</td>'; print '<td align="right">'.dol_print_date($db->jdate($obj->date_demande),'day').'</td>';
print '<td align="right"></td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
print "</table><br>"; print "</table><br>";
print '</form>';
} }
else else
{ {

View File

@ -81,7 +81,7 @@ if (GETPOST('actioncode','array'))
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
$search_agenda_label=GETPOST('search_agenda_label'); $search_agenda_label=GETPOST('search_agenda_label');

View File

@ -714,6 +714,11 @@ else
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} }
else
{
print ' &nbsp; &nbsp; ';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
}
print '</div>'; print '</div>';
print "</form>"; print "</form>";
@ -997,7 +1002,7 @@ else
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
@ -1229,33 +1234,7 @@ else
} }
print "</div>"; print "</div>";
//print "<br>";
/*
if (! empty($conf->agenda->enabled))
{
$objthirdparty=$objsoc;
$objcon=$object;
$out='';
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
$out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1">';
$out.=$langs->trans("AddAnAction").' ';
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
$out.="</a>";
}
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),$out,'');
//print show_actions_todo($conf,$langs,$db,$objsoc,$object);
print show_actions_done($conf,$langs,$db,$objsoc,$object,0,'','');
}
*/
} }
} }

View File

@ -77,7 +77,7 @@ $userid=GETPOST('userid','int');
$begin=GETPOST('begin'); $begin=GETPOST('begin');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname"; if (! $sortfield) $sortfield="p.lastname";
if ($page < 0) { $page = 0; } if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$langs->load("companies"); $langs->load("companies");
@ -147,7 +147,7 @@ $arrayfields=array(
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
} }
@ -176,7 +176,7 @@ if (empty($reshook))
{ {
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
{ {
@ -200,7 +200,7 @@ if (empty($reshook))
$search_categ_supplier=''; $search_categ_supplier='';
$search_array_options=array(); $search_array_options=array();
} }
// Mass actions // Mass actions
$objectclass='Contact'; $objectclass='Contact';
$objectlabel='Contact'; $objectlabel='Contact';
@ -345,7 +345,7 @@ foreach ($search_array_options as $key => $val)
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }
@ -424,7 +424,7 @@ foreach ($search_array_options as $key => $val)
$crit=$val; $crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -504,9 +504,9 @@ if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_tit
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -555,13 +555,13 @@ if (! empty($arrayfields['p.town']['checked']))
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">'; print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.phone']['checked'])) if (! empty($arrayfields['p.phone']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).'">'; print '<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.phone_perso']['checked'])) if (! empty($arrayfields['p.phone_perso']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).'">'; print '<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).'">';
@ -607,9 +607,9 @@ if (! empty($arrayfields['p.priv']['checked']))
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
@ -664,7 +664,7 @@ while ($i < min($num,$limit))
$contactstatic->phone_mobile=$obj->phone_mobile; $contactstatic->phone_mobile=$obj->phone_mobile;
$contactstatic->zip=$obj->zip; $contactstatic->zip=$obj->zip;
$contactstatic->town=$obj->town; $contactstatic->town=$obj->town;
// Name // Name
if (! empty($arrayfields['p.lastname']['checked'])) if (! empty($arrayfields['p.lastname']['checked']))
{ {
@ -746,9 +746,9 @@ while ($i < min($num,$limit))
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
print '<td'; print '<td';
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);

View File

@ -8,7 +8,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -2253,11 +2253,11 @@ class Contrat extends CommonObject
$this->context['createfromclone'] = 'createfromclone'; $this->context['createfromclone'] = 'createfromclone';
$error = 0; $error = 0;
$now = dol_now();
$this->fetch($this->id); $this->fetch($this->id);
// Load dest object // Load dest object
$clonedObj = clone $this; $clonedObj = clone $this;
$clonedObj->socid = $socid;
$this->db->begin(); $this->db->begin();
@ -2292,16 +2292,13 @@ class Contrat extends CommonObject
$this->error = $clonedObj->error; $this->error = $clonedObj->error;
$this->errors[] = $clonedObj->error; $this->errors[] = $clonedObj->error;
} else { } else {
// copy internal contacts // copy external contacts if same company
if ($clonedObj->copy_linked_contact($this, 'internal') < 0) if ($this->socid == $clonedObj->socid) {
$error ++; if ($clonedObj->copy_linked_contact($this, 'external') < 0) {
$error++;
// copy external contacts if same company }
elseif ($this->socid == $clonedObj->socid) { }
if ($clonedObj->copy_linked_contact($this, 'external') < 0) }
$error ++;
}
}
if (! $error) { if (! $error) {
foreach ( $this->lines as $line ) { foreach ( $this->lines as $line ) {

View File

@ -272,7 +272,7 @@ $sql.= " state.code_departement, state.nom";
// Add where from extra fields // Add where from extra fields
foreach ($extrafields->attribute_label as $key => $val) foreach ($extrafields->attribute_label as $key => $val)
{ {
$sql .= ', ef.'.$val; $sql .= ', ef.'.$key;
} }
// Add where from hooks // Add where from hooks
$parameters=array(); $parameters=array();

View File

@ -2771,6 +2771,7 @@ abstract class CommonObject
$this->db->begin(); $this->db->begin();
$fieldstatus="fk_statut"; $fieldstatus="fk_statut";
if ($elementTable == 'mailing') $fieldstatus="statut";
if ($elementTable == 'user') $fieldstatus="statut"; if ($elementTable == 'user') $fieldstatus="statut";
if ($elementTable == 'expensereport') $fieldstatus="fk_statut"; if ($elementTable == 'expensereport') $fieldstatus="fk_statut";
if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status"; if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status";

View File

@ -41,10 +41,10 @@ class DiscountAbsolute
public $fk_user; // Id utilisateur qui accorde la remise public $fk_user; // Id utilisateur qui accorde la remise
public $description; // Description libre public $description; // Description libre
public $datec; // Date creation public $datec; // Date creation
public $fk_facture_line; // Id invoice line when a discount linked to invoice line (for absolute discounts) public $fk_facture_line; // Id invoice line when a discount is used into an invoice line (for absolute discounts)
public $fk_facture; // Id invoice when a discoutn linked to invoice (for credit note) public $fk_facture; // Id invoice when a discount line is used into an invoice (for credit note)
public $fk_facture_source; // Id facture avoir a l'origine de la remise public $fk_facture_source; // Id facture avoir a l'origine de la remise
public $ref_facture_source; // Ref facture avoir a l'origine de la remise public $ref_facture_source; // Ref facture avoir a l'origine de la remise
/** /**
* Constructor * Constructor
@ -296,7 +296,7 @@ class DiscountAbsolute
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->fk_facture_source=$rowidline; $this->fk_facture_line=$rowidline;
$this->fk_facture=$rowidinvoice; $this->fk_facture=$rowidinvoice;
return 1; return 1;
} }

View File

@ -1372,7 +1372,7 @@ class Form
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list * @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param array $exclude Array list of users id to exclude * @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled * @param int $disabled If select list must be disabled
* @param array $include Array list of users id to include or 'hierarchy' to have only supervised users * @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param array $enableonly Array list of users id to be enabled. All other must be disabled * @param array $enableonly Array list of users id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit) * @param int $maxlength Maximum length of string into list (0=no limit)
@ -1396,24 +1396,20 @@ class Form
$includeUsers=null; $includeUsers=null;
// Permettre l'exclusion d'utilisateurs // Permettre l'exclusion d'utilisateurs
if (is_array($exclude)) $excludeUsers = implode("','",$exclude); if (is_array($exclude)) $excludeUsers = implode(",",$exclude);
// Permettre l'inclusion d'utilisateurs // Permettre l'inclusion d'utilisateurs
if (is_array($include)) $includeUsers = implode("','",$include); if (is_array($include)) $includeUsers = implode(",",$include);
else if ($include == 'hierarchy') else if ($include == 'hierarchy')
{ {
// Build list includeUsers to have only hierarchy // Build list includeUsers to have only hierarchy
$userid=$user->id; $includeUsers = implode(",",$user->getAllChildIds(0));
$include=array();
if (empty($user->users) || ! is_array($user->users)) $user->get_full_tree();
foreach($user->users as $key => $val)
{
if (preg_match('/_'.$userid.'/',$val['fullpath'])) $include[]=$val['id'];
}
$includeUsers = implode("','",$include);
//var_dump($includeUsers);exit;
//var_dump($user->users);exit;
} }
else if ($include == 'hierarchyme')
{
// Build list includeUsers to have only hierarchy and current user
$includeUsers = implode(",",$user->getAllChildIds(1));
}
$out=''; $out='';
// On recherche les utilisateurs // On recherche les utilisateurs
@ -1443,8 +1439,8 @@ class Form
} }
} }
if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id; if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id;
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')"; if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN (".$excludeUsers.")";
if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')"; if ($includeUsers) $sql.= " AND u.rowid IN (".$includeUsers.")";
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0"; if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0";
if (! empty($morefilter)) $sql.=" ".$morefilter; if (! empty($morefilter)) $sql.=" ".$morefilter;
$sql.= " ORDER BY u.lastname ASC"; $sql.= " ORDER BY u.lastname ASC";

View File

@ -669,7 +669,7 @@ class FormFile
// Show file name with link to download // Show file name with link to download
$out.= '<td class="nowrap">'; $out.= '<td class="nowrap">';
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"'; $out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
$mime=dol_mimetype($relativepath,'',0); $mime=dol_mimetype($relativepath,'',0);
if (preg_match('/text/',$mime)) $out.= ' target="_blank"'; if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
$out.= ' target="_blank">'; $out.= ' target="_blank">';

View File

@ -48,6 +48,7 @@ class FormMargin
/** /**
* get array with margin information from lines of object * get array with margin information from lines of object
* TODO Move this in common class.
* *
* @param CommonObject $object Object we want to get margin information for * @param CommonObject $object Object we want to get margin information for
* @param boolean $force_price True of not * @param boolean $force_price True of not
@ -92,19 +93,23 @@ class FormMargin
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
} }
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
$pa = $line->qty * $pa_ht;
// calcul des marges // calcul des marges
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
$marginInfos['pa_products'] += $pa; $marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv; $marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv; $marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price) // if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0) //if ($pv < 0)
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); //{
else // $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
//}
//else
$marginInfos['margin_on_products'] += $pv - $pa; $marginInfos['margin_on_products'] += $pv - $pa;
} }
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
@ -113,9 +118,9 @@ class FormMargin
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv; $marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price) // if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0) //if ($pv < 0)
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
else //else
$marginInfos['margin_on_services'] += $pv - $pa; $marginInfos['margin_on_services'] += $pv - $pa;
} }
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
@ -126,29 +131,29 @@ class FormMargin
else { else {
$type=$line->product_type?$line->product_type:$line->fk_product_type; $type=$line->product_type?$line->product_type:$line->fk_product_type;
if ($type == 0) { // product if ($type == 0) { // product
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_products'] += $pa; $marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv; $marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv; $marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price) // if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0) //if ($pv < 0)
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); //{
else // $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
$marginInfos['margin_on_products'] += $pv - $pa; //}
//else
//{
$marginInfos['margin_on_products'] += $pv - $pa;
//}
} }
elseif ($type == 1) { // service elseif ($type == 1) { // service
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_services'] += $pa; $marginInfos['pa_services'] += $pa;
$marginInfos['pv_services'] += $pv; $marginInfos['pv_services'] += $pv;
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv; $marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price) // if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0) //if ($pv < 0)
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
else //else
$marginInfos['margin_on_services'] += $pv - $pa; $marginInfos['margin_on_services'] += $pv - $pa;
} }
} }
@ -164,9 +169,9 @@ class FormMargin
$marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services']; $marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services'];
// if credit note, margin = -1 * (abs(selling_price) - buying_price) // if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($marginInfos['pv_total'] < 0) //if ($marginInfos['pv_total'] < 0)
$marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']); // $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']);
else //else
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
if ($marginInfos['pa_total'] > 0) if ($marginInfos['pa_total'] > 0)
$marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total']; $marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total'];

View File

@ -155,8 +155,10 @@ class FormProjets
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
if (!empty($filterkey)) { if (!empty($filterkey)) {
$sql .= " AND p.title LIKE '%".$this->db->escape($filterkey)."%'"; $sql .= ' AND (';
$sql .= " OR p.ref LIKE '%".$this->db->escape($filterkey)."%'"; $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"';
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
$sql .= ')';
} }
$sql.= " ORDER BY p.ref ASC"; $sql.= " ORDER BY p.ref ASC";
@ -564,9 +566,10 @@ class FormProjets
* @param int $useshortlabel Use short label * @param int $useshortlabel Use short label
* @param int $showallnone Add choice "All" and "None" * @param int $showallnone Add choice "All" and "None"
* @param int $showpercent Show default probability for status * @param int $showpercent Show default probability for status
* @param string $morecss Add more css
* @return int|string The HTML select list of element or '' if nothing or -1 if KO * @return int|string The HTML select list of element or '' if nothing or -1 if KO
*/ */
function selectOpportunityStatus($htmlname, $preselected='-1', $showempty=1, $useshortlabel=0, $showallnone=0, $showpercent=0) function selectOpportunityStatus($htmlname, $preselected='-1', $showempty=1, $useshortlabel=0, $showallnone=0, $showpercent=0, $morecss='')
{ {
global $conf, $langs; global $conf, $langs;
@ -582,7 +585,7 @@ class FormProjets
$i = 0; $i = 0;
if ($num > 0) if ($num > 0)
{ {
$sellist = '<select class="flat oppstatus" id="'.$htmlname.'" name="'.$htmlname.'">'; $sellist = '<select class="flat oppstatus'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $sellist.= '<option value="-1"></option>'; if ($showempty) $sellist.= '<option value="-1"></option>';
if ($showallnone) $sellist.= '<option value="all"'.($preselected == 'all'?' selected="selected"':'').'>--'.$langs->trans("OnlyOpportunitiesShort").'--</option>'; if ($showallnone) $sellist.= '<option value="all"'.($preselected == 'all'?' selected="selected"':'').'>--'.$langs->trans("OnlyOpportunitiesShort").'--</option>';
if ($showallnone) $sellist.= '<option value="openedopp"'.($preselected == 'openedopp'?' selected="selected"':'').'>--'.$langs->trans("OpenedOpportunitiesShort").'--</option>'; if ($showallnone) $sellist.= '<option value="openedopp"'.($preselected == 'openedopp'?' selected="selected"':'').'>--'.$langs->trans("OpenedOpportunitiesShort").'--</option>';

View File

@ -1308,7 +1308,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs)); if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs));
if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch); if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch);
$dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty); $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty);
$libelleproduitservice.= "__N__ ".implode($dte,"-"); $libelleproduitservice.= "__N__ ".implode(" - ", $dte);
} }
} }

View File

@ -339,7 +339,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
} }
/** /**
* Check access by user to object * Check access by user to object.
* This function is also called by restrictedArea
* *
* @param User $user User to check * @param User $user User to check
* @param array $featuresarray Features/modules to check * @param array $featuresarray Features/modules to check
@ -348,8 +349,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
*
* @return bool True if user has access, False otherwise * @return bool True if user has access, False otherwise
* @see restrictedArea
*/ */
function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='rowid') function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='rowid')
{ {

View File

@ -6,6 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1261,10 +1262,12 @@ class pdf_einstein extends ModelePDFCommandes
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
if (count($arrayidcontact) > 0) if (count($arrayidcontact) > 0)
{ {
$usertmp=new User($this->db); $usertmp=new User($this->db);
$usertmp->fetch($arrayidcontact[0]); $usertmp->fetch($arrayidcontact[0]);
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(190, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
} }
} }

View File

@ -7,6 +7,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1620,8 +1621,10 @@ class pdf_crabe extends ModelePDFFactures
{ {
$usertmp=new User($this->db); $usertmp=new User($this->db);
$usertmp->fetch($arrayidcontact[0]); $usertmp->fetch($arrayidcontact[0]);
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(190, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell($w, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
} }
} }

View File

@ -26,6 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
class mailing_advthirdparties extends MailingTargets class mailing_advthirdparties extends MailingTargets
{ {
var $name='ThirdPartyAdvancedTargeting'; var $name='ThirdPartyAdvancedTargeting';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc="Third parties"; var $desc="Third parties";
var $require_admin=0; var $require_admin=0;

View File

@ -34,12 +34,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_contacts1 extends MailingTargets class mailing_contacts1 extends MailingTargets
{ {
var $name='ContactCompanies'; // Identifiant du module mailing var $name='ContactCompanies'; // Identifiant du module mailing
// This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='Contacts des tiers (prospects, clients, fournisseurs...)'; var $desc='Contacts of thirdparties (prospects, customers, suppliers...)';
var $require_module=array("societe"); // Module mailing actif si modules require_module actifs var $require_module=array("societe"); // Module mailing actif si modules require_module actifs
var $require_admin=0; // Module mailing actif pour user admin ou non var $require_admin=0; // Module mailing actif pour user admin ou non
var $picto='contact'; var $picto='contact';
var $db; var $db;

View File

@ -33,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_contacts2 extends MailingTargets class mailing_contacts2 extends MailingTargets
{ {
var $name='ContactsByFunction'; var $name='ContactsByFunction';
// This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='Add contacts by function'; var $desc='Add contacts by function';
var $require_admin=0; var $require_admin=0;

View File

@ -32,8 +32,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_contacts3 extends MailingTargets class mailing_contacts3 extends MailingTargets
{ {
var $name='ContactsByCompanyCategory'; var $name='ContactsByCompanyCategory';
// This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='Add contacts by company category'; var $desc='Add contacts by company category';
var $require_admin=0; var $require_admin=0;
var $require_module=array(); var $require_module=array();

View File

@ -32,8 +32,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_contacts4 extends MailingTargets class mailing_contacts4 extends MailingTargets
{ {
var $name='ContactsByCategory'; var $name='ContactsByCategory';
// This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='Add contacts by category'; var $desc='Add contacts by category';
var $require_admin=0; var $require_admin=0;
var $require_module=array(); var $require_module=array();

View File

@ -32,7 +32,9 @@ class mailing_example extends MailingTargets
var $desc='Put here a description'; var $desc='Put here a description';
// CHANGE THIS: Set to 1 if selector is available for admin users only // CHANGE THIS: Set to 1 if selector is available for admin users only
var $require_admin=0; var $require_admin=0;
// CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector
var $tooltip='MyTooltipLangKey';
var $require_module=array(); var $require_module=array();
var $picto=''; var $picto='';
var $db; var $db;

View File

@ -32,12 +32,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
*/ */
class mailing_fraise extends MailingTargets class mailing_fraise extends MailingTargets
{ {
// CHANGE THIS: Put here a name not already used
var $name='FundationMembers'; // Identifiant du module mailing var $name='FundationMembers'; // Identifiant du module mailing
// CHANGE THIS: Put here a description of your selector module. // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
// This label is used if no translation found for key MailingModuleDescXXX where XXX=name is found
var $desc='Foundation members with emails (by status)'; var $desc='Foundation members with emails (by status)';
// CHANGE THIS: Set to 1 if selector is available for admin users only // Set to 1 if selector is available for admin users only
var $require_admin=0; var $require_admin=0;
var $require_module=array('adherent'); var $require_module=array('adherent');

View File

@ -23,12 +23,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
*/ */
class mailing_framboise extends MailingTargets class mailing_framboise extends MailingTargets
{ {
// CHANGE THIS: Put here a name not already used
var $name='MembersCategories'; var $name='MembersCategories';
// CHANGE THIS: Put here a description of your selector module. // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
// This label is used if no translation found for key MailingModuleDescXXX where XXX=name is found
var $desc="Foundation members with emails (by categories)"; var $desc="Foundation members with emails (by categories)";
// CHANGE THIS: Set to 1 if selector is available for admin users only // Set to 1 if selector is available for admin users only
var $require_admin=0; var $require_admin=0;
var $require_module=array("adherent","categorie"); var $require_module=array("adherent","categorie");

View File

@ -49,7 +49,7 @@ class MailingTargets // This can't be abstract as it is used for some method
/** /**
* Return description of email selector * Return description of email selector
* *
* @return string Retourne la traduction de la cle MailingModuleDescXXX ou XXX nom du module, ou $this->desc si non trouve * @return string Return translation of module label. Try translation of $this->name then translation of 'MailingModuleDesc'.$this->name, or $this->desc if not found
*/ */
function getDesc() function getDesc()
{ {
@ -58,7 +58,9 @@ class MailingTargets // This can't be abstract as it is used for some method
$langs->load("mails"); $langs->load("mails");
$transstring="MailingModuleDesc".$this->name; $transstring="MailingModuleDesc".$this->name;
$s=''; $s='';
if ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring);
if ($langs->trans($this->name) != $this->name) $s=$langs->trans($this->name);
elseif ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring);
else $s=$this->desc; else $s=$this->desc;
if ($this->tooltip && is_object($form)) $s .= ' '.$form->textwithpicto('', $langs->trans($this->tooltip), 1, 1); if ($this->tooltip && is_object($form)) $s .= ' '.$form->textwithpicto('', $langs->trans($this->tooltip), 1, 1);

View File

@ -31,6 +31,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_pomme extends MailingTargets class mailing_pomme extends MailingTargets
{ {
var $name='DolibarrUsers'; // Identifiant du module mailing var $name='DolibarrUsers'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e var $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e
var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_module=array(); // Module mailing actif si modules require_module actifs
var $require_admin=1; // Module mailing actif pour user admin ou non var $require_admin=1; // Module mailing actif pour user admin ou non

View File

@ -24,6 +24,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_thirdparties extends MailingTargets class mailing_thirdparties extends MailingTargets
{ {
var $name='ContactsCategories'; var $name='ContactsCategories';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc="Third parties (by categories)"; var $desc="Third parties (by categories)";
var $require_admin=0; var $require_admin=0;

View File

@ -23,6 +23,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
class mailing_thirdparties_services_expired extends MailingTargets class mailing_thirdparties_services_expired extends MailingTargets
{ {
var $name='DolibarrContractsLinesExpired'; var $name='DolibarrContractsLinesExpired';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='Third parties with expired contract\'s lines'; var $desc='Third parties with expired contract\'s lines';
var $require_admin=0; var $require_admin=0;

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
class mailing_xinputfile extends MailingTargets class mailing_xinputfile extends MailingTargets
{ {
var $name='EmailsFromFile'; // Identifiant du module mailing var $name='EmailsFromFile'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e var $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e
var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_module=array(); // Module mailing actif si modules require_module actifs
var $require_admin=0; // Module mailing actif pour user admin ou non var $require_admin=0; // Module mailing actif pour user admin ou non

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
class mailing_xinputuser extends MailingTargets class mailing_xinputuser extends MailingTargets
{ {
var $name='EmailsFromUser'; // Identifiant du module mailing var $name='EmailsFromUser'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
var $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e var $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv<75>e
var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_module=array(); // Module mailing actif si modules require_module actifs
var $require_admin=0; // Module mailing actif pour user admin ou non var $require_admin=0; // Module mailing actif pour user admin ou non

View File

@ -111,54 +111,62 @@ class modExpenseReport extends DolibarrModules
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$this->rights_class = 'expensereport'; $this->rights_class = 'expensereport';
$this->rights[1][0] = 771; $this->rights[$r][0] = 771;
$this->rights[1][1] = 'Read expense reports (yours and your subordinates)'; $this->rights[$r][1] = 'Read expense reports (yours and your subordinates)';
$this->rights[1][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[1][3] = 0; $this->rights[$r][3] = 0;
$this->rights[1][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++;
$this->rights[3][0] = 772;
$this->rights[3][1] = 'Create/modify expense reports'; $this->rights[$r][0] = 772;
$this->rights[3][2] = 'w'; $this->rights[$r][1] = 'Create/modify expense reports';
$this->rights[3][3] = 0; $this->rights[$r][2] = 'w';
$this->rights[3][4] = 'creer'; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer';
$this->rights[4][0] = 773; $r++;
$this->rights[4][1] = 'Delete expense reports';
$this->rights[4][2] = 'd'; $this->rights[$r][0] = 773;
$this->rights[4][3] = 0; $this->rights[$r][1] = 'Delete expense reports';
$this->rights[4][4] = 'supprimer'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[6][0] = 775; $this->rights[$r][4] = 'supprimer';
$this->rights[6][1] = 'Approve expense reports'; $r++;
$this->rights[6][2] = 'w';
$this->rights[6][3] = 0; $this->rights[$r][0] = 775;
$this->rights[6][4] = 'approve'; $this->rights[$r][1] = 'Approve expense reports';
$this->rights[$r][2] = 'w';
$this->rights[7][0] = 776; $this->rights[$r][3] = 0;
$this->rights[7][1] = 'Pay expense reports'; $this->rights[$r][4] = 'approve';
$this->rights[7][2] = 'w'; $r++;
$this->rights[7][3] = 0;
$this->rights[7][4] = 'to_paid'; $this->rights[$r][0] = 776;
$this->rights[$r][1] = 'Pay expense reports';
$this->rights[2][0] = 777; $this->rights[$r][2] = 'w';
$this->rights[2][1] = 'Read expense reports of everybody'; $this->rights[$r][3] = 0;
$this->rights[2][2] = 'r'; $this->rights[$r][4] = 'to_paid';
$this->rights[2][3] = 1; $r++;
$this->rights[2][4] = 'readall';
$this->rights[$r][0] = 777;
$this->rights[2][0] = 778; $this->rights[$r][1] = 'Read expense reports of everybody';
$this->rights[2][1] = 'Create expense reports for everybody'; $this->rights[$r][2] = 'r';
$this->rights[2][2] = 'w'; $this->rights[$r][3] = 1;
$this->rights[2][3] = 0; $this->rights[$r][4] = 'readall';
$this->rights[2][4] = 'writeall_advance'; $r++;
$this->rights[5][0] = 779; $this->rights[$r][0] = 778;
$this->rights[5][1] = 'Export expense reports'; $this->rights[$r][1] = 'Create expense reports for everybody';
$this->rights[5][2] = 'r'; $this->rights[$r][2] = 'w';
$this->rights[5][3] = 0; $this->rights[$r][3] = 0;
$this->rights[5][4] = 'export'; $this->rights[$r][4] = 'writeall_advance';
$r++;
$this->rights[$r][0] = 779;
$this->rights[$r][1] = 'Export expense reports';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export';
$r++;
// Menus // Menus
//------- //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager. $this->menu = 1; // This module add menu entries. They are coded into menu manager.

View File

@ -165,11 +165,11 @@ class modProduct extends DolibarrModules
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_buy'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product");
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category'));
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'company','pf.ref_fourn'=>'product','pf.unitprice'=>'product'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -211,7 +211,35 @@ class modProduct extends DolibarrModules
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')';
} }
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
{
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('pa.qty'=>'Numeric'));
$this->export_entities_array[$r]=array('p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct','p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct");
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct'));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')';
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
}
// Imports // Imports
//-------- //--------

View File

@ -219,22 +219,28 @@ class modProjet extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', 's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", 'p.entity'=>'Numeric', 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); 's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description");
// Add multicompany field // Add multicompany field
if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
{ {
$nbofallowedentities=count(explode(',',getEntity('project',1))); // If project are shared, nb will be > 1 $nbofallowedentities=count(explode(',',getEntity('project',1))); // If project are shared, nb will be > 1
if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity'); if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity');
} }
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
unset($this->export_fields_array[$r]['p.opp_percent']);
unset($this->export_fields_array[$r]['p.opp_amount']);
unset($this->export_fields_array[$r]['cls.code']);
}
// Add fields for project // Add fields for project
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';

View File

@ -252,7 +252,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
// Get Mask value // Get Mask value
$mask = ''; $mask = '';
if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT;
if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE;
if (! $mask) if (! $mask)
{ {
$this->error='NotConfigured'; $this->error='NotConfigured';

View File

@ -6,6 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1473,8 +1474,10 @@ class pdf_azur extends ModelePDFPropales
{ {
$usertmp=new User($this->db); $usertmp=new User($this->db);
$usertmp->fetch($arrayidcontact[0]); $usertmp->fetch($arrayidcontact[0]);
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(190, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
} }
} }

View File

@ -4,6 +4,7 @@
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1111,8 +1112,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{ {
$usertmp=new User($this->db); $usertmp=new User($this->db);
$usertmp->fetch($arrayidcontact[0]); $usertmp->fetch($arrayidcontact[0]);
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(190, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
} }
} }

View File

@ -4,6 +4,7 @@
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1288,8 +1289,10 @@ class pdf_aurore extends ModelePDFSupplierProposal
{ {
$usertmp=new User($this->db); $usertmp=new User($this->db);
$usertmp->fetch($arrayidcontact[0]); $usertmp->fetch($arrayidcontact[0]);
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(190, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
} }
} }

View File

@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Need global variable $title to be defined by caller (like dol_loginfunction)
header('Cache-Control: Public, must-revalidate'); header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
@ -35,7 +38,10 @@ $arrayofjs=array(
); );
$titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. $titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version.
print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs); $disablenofollow=1;
if (! preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow=0;
print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);
?> ?>
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP --> <!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
@ -71,7 +77,13 @@ $(document).ready(function () {
<input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" /> <input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" />
<table class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>"> <table class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<tr class="vmenu"><td class="center"><?php echo dol_escape_htmltag($title); ?></td></tr> <tr class="vmenu"><td class="center">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
?>
</td></tr>
</table> </table>
<br> <br>

View File

@ -70,19 +70,20 @@ if (empty($usemargins)) $usemargins=0;
<?php <?php
if ($line->description) if ($line->description)
{ {
if ($line->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0)
{ {
$discount=new DiscountAbsolute($this->db); $discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except); $discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
} }
elseif ($line->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0)
{ {
$discount=new DiscountAbsolute($this->db); $discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except); $discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
// Add date of deposit // Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
echo ' ('.dol_print_date($discount->datec).')';
} }
else else
{ {

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1228,8 +1229,8 @@ if ($action == 'create')
print '<td>'; print '<td>';
$defaultselectuser=$user->id; $defaultselectuser=$user->id;
if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author'); if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author');
$include_users = array($user->id); $include_users = 'hierarchyme';
if (! empty($user->rights->expensereport->writeall)) $include_users=array(); if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expensereport->writeall_advance)) $include_users=array();
$s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users); $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users);
print $s; print $s;
print '</td>'; print '</td>';
@ -1313,10 +1314,10 @@ else
if ($result > 0) if ($result > 0)
{ {
if ($object->fk_user_author != $user->id) if (! in_array($object->fk_user_author, $user->getAllChildIds(1)))
{ {
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
&& empty($user->rights->expensereport->writeall_advance)) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
{ {
print load_fiche_titre($langs->trans('TripCard')); print load_fiche_titre($langs->trans('TripCard'));
@ -2090,7 +2091,7 @@ if ($action != 'create' && $action != 'edit')
*/ */
if ($user->rights->expensereport->creer && $object->fk_statut==0) if ($user->rights->expensereport->creer && $object->fk_statut==0)
{ {
if ($object->fk_user_author == $user->id) if (in_array($object->fk_user_author, $user->getAllChildIds(1)))
{ {
// Modify // Modify
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans('Modify').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
@ -2138,7 +2139,7 @@ if ($action != 'create' && $action != 'edit')
*/ */
if ($object->fk_statut == 2) if ($object->fk_statut == 2)
{ {
if ($object->fk_user_author == $user->id) if (in_array($object->fk_user_author, $user->getAllChildIds(1)))
{ {
// Brouillonner // Brouillonner
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=brouillonner&id='.$object->id.'">'.$langs->trans('SetToDraft').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=brouillonner&id='.$object->id.'">'.$langs->trans('SetToDraft').'</a></div>';

View File

@ -60,7 +60,7 @@ class ExpenseReport extends CommonObject
// Create // Create
var $date_create; var $date_create;
var $fk_user_author; var $fk_user_author; // the user the expense report is for (not really the author)
// Update // Update
var $date_modif; var $date_modif;
@ -1674,11 +1674,14 @@ class ExpenseReport extends CommonObject
$now=dol_now(); $now=dol_now();
$userchildids = $user->getAllChildIds(1);
$sql = "SELECT ex.rowid, ex.date_valid"; $sql = "SELECT ex.rowid, ex.date_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2"; if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2";
else $sql.= " WHERE ex.fk_statut = 5"; else $sql.= " WHERE ex.fk_statut = 5";
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")"; $sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
$sql.= " AND ex.fk_user_author IN (".join(',',$userchildids).")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -524,13 +524,14 @@ class PaymentExpenseReport extends CommonObject
{ {
if ($mode == 'payment_expensereport') if ($mode == 'payment_expensereport')
{ {
$euser = new User($this->db); $er = new ExpenseReport($this->db);
$euser->fetch($key); $er->fetch($key);
$er->fetch_user($er->fk_user_author);
$result=$acc->add_url_line( $result=$acc->add_url_line(
$bank_line_id, $bank_line_id,
$euser->id, $er->user->id,
DOL_URL_ROOT.'/user/card.php?id=', DOL_URL_ROOT.'/user/card.php?id=',
$euser->getFullName($langs), $er->user->getFullName($langs),
'user' 'user'
); );
if ($result <= 0) if ($result <= 0)

View File

@ -240,7 +240,7 @@ if ($search_status != '' && $search_status >= 0)
} }
// RESTRICT RIGHTS // RESTRICT RIGHTS
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
&& empty($user->rights->expensereport->writeall_advance)) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
{ {
$childids = $user->getAllChildIds(); $childids = $user->getAllChildIds();
$childids[]=$user->id; $childids[]=$user->id;

View File

@ -61,6 +61,8 @@ $entitytoicon = array(
'other' => 'generic', 'other' => 'generic',
'account' => 'account', 'account' => 'account',
'product' => 'product', 'product' => 'product',
'virtualproduct'=>'product',
'subproduct' => 'product',
'warehouse' => 'stock', 'warehouse' => 'stock',
'batch' => 'stock', 'batch' => 'stock',
'category' => 'category', 'category' => 'category',
@ -93,6 +95,8 @@ $entitytolang = array(
'account' => 'BankTransactions', 'account' => 'BankTransactions',
'payment' => 'Payment', 'payment' => 'Payment',
'product' => 'Product', 'product' => 'Product',
'virtualproduct' => 'AssociatedProducts',
'subproduct' => 'SubProduct',
'service' => 'Service', 'service' => 'Service',
'stock' => 'Stock', 'stock' => 'Stock',
'batch' => 'Batch', 'batch' => 'Batch',

View File

@ -1929,6 +1929,7 @@ class FactureFournisseur extends CommonInvoice
} }
else else
{ {
$this->error=$obj->error;
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
return false; return false;
} }

View File

@ -6,6 +6,7 @@
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr> * Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -368,7 +369,7 @@ if ($id > 0 || ! empty($ref)) {
print "</td></tr>"; print "</td></tr>";
if ($object->methode_commande) { if ($object->methode_commande) {
print '<tr><td>' . $langs->trans("Method") . '</td><td>' . $commande->getInputMethod() . '</td></tr>'; print '<tr><td>' . $langs->trans("Method") . '</td><td>' . $object->getInputMethod() . '</td></tr>';
} }
} }

View File

@ -45,7 +45,7 @@ if (GETPOST('actioncode','array'))
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECTS)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECTS));
} }
$search_agenda_label=GETPOST('search_agenda_label'); $search_agenda_label=GETPOST('search_agenda_label');

View File

@ -77,6 +77,7 @@ $search_total_vat=GETPOST('search_total_vat','alpha');
$search_total_ttc=GETPOST('search_total_ttc','alpha'); $search_total_ttc=GETPOST('search_total_ttc','alpha');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int'); $billed = GETPOST('billed','int');
$search_project_ref=GETPOST('search_project_ref','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
@ -204,6 +205,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$deliverymonth=''; $deliverymonth='';
$deliveryyear=''; $deliveryyear='';
$billed=''; $billed='';
$search_project_ref='';
$search_array_options=array(); $search_array_options=array();
} }
@ -350,6 +352,7 @@ if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.elemen
if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1); if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1);
if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1); if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1);
if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1); if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1);
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
// Add where from extra fields // Add where from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -15,7 +16,6 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
?> ?>
@ -48,7 +48,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td align="right"><?php <td align="right"><?php
if ($user->rights->fournisseur->facture->lire) { if ($user->rights->fournisseur->facture->lire) {
$sign = 1; $sign = 1;
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1; if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1;
if ($objectlink->statut != 3) // If not abandonned if ($objectlink->statut != 3) // If not abandonned
{ {
$total = $total + $sign * $objectlink->total_ht; $total = $total + $sign * $objectlink->total_ht;

View File

@ -178,8 +178,8 @@ if (empty($user->societe_id))
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), ! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), ! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, ! empty($conf->projet->enabled) && $user->rights->projet->lire,
! empty($conf->projet->enabled) && $user->rights->projet->lire ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
); );
// Class file containing the method load_state_board for each line // Class file containing the method load_state_board for each line
$includes=array( $includes=array(
@ -199,8 +199,8 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
DOL_DOCUMENT_ROOT."/projet/class/project.class.php" DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php"
); );
// Name class containing the method load_state_board for each line // Name class containing the method load_state_board for each line
$classes=array('User', $classes=array('User',
@ -219,8 +219,8 @@ if (empty($user->societe_id))
'CommandeFournisseur', 'CommandeFournisseur',
'FactureFournisseur', 'FactureFournisseur',
'SupplierProposal', 'SupplierProposal',
'ExpenseReport', 'Project',
'Project' 'ExpenseReport'
); );
// Cle array returned by the method load_state_board for each line // Cle array returned by the method load_state_board for each line
$keys=array('users', $keys=array('users',
@ -239,8 +239,8 @@ if (empty($user->societe_id))
'supplier_orders', 'supplier_orders',
'supplier_invoices', 'supplier_invoices',
'askprice', 'askprice',
'expensereports', 'projects',
'projects' 'expensereports'
); );
// Dashboard Icon lines // Dashboard Icon lines
$icons=array('user', $icons=array('user',
@ -259,8 +259,8 @@ if (empty($user->societe_id))
'order', 'order',
'bill', 'bill',
'propal', 'propal',
'trip', 'project',
'project' 'trip'
); );
// Translation keyword // Translation keyword
$titres=array("Users", $titres=array("Users",
@ -279,8 +279,8 @@ if (empty($user->societe_id))
"SuppliersOrders", "SuppliersOrders",
"SuppliersInvoices", "SuppliersInvoices",
"SupplierProposalShort", "SupplierProposalShort",
"ExpenseReports", "Projects",
"Projects" "ExpenseReports"
); );
// Dashboard Link lines // Dashboard Link lines
$links=array( $links=array(
@ -300,8 +300,8 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/fourn/commande/list.php', DOL_URL_ROOT.'/fourn/commande/list.php',
DOL_URL_ROOT.'/fourn/facture/list.php', DOL_URL_ROOT.'/fourn/facture/list.php',
DOL_URL_ROOT.'/supplier_proposal/list.php', DOL_URL_ROOT.'/supplier_proposal/list.php',
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm', DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
DOL_URL_ROOT.'/projet/list.php?mainmenu=project' DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'
); );
// Translation lang files // Translation lang files
$langfile=array("users", $langfile=array("users",
@ -318,8 +318,8 @@ if (empty($user->societe_id))
"supplier_proposal", "supplier_proposal",
"contracts", "contracts",
"interventions", "interventions",
"trips", "projects",
"projects" "trips"
); );

View File

@ -35,7 +35,7 @@ CREATE TABLE llx_expensereport (
date_refuse datetime, date_refuse datetime,
date_cancel datetime, date_cancel datetime,
tms timestamp, tms timestamp,
fk_user_author integer NOT NULL, fk_user_author integer NOT NULL, -- not the user author but the user the expense report is for
fk_user_modif integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL,
fk_user_valid integer DEFAULT NULL, fk_user_valid integer DEFAULT NULL,
fk_user_validator integer DEFAULT NULL, fk_user_validator integer DEFAULT NULL,

View File

@ -689,7 +689,7 @@ PermissionAdvanced253=Create/modify internal/external users and permissions
Permission254=Create/modify external users only Permission254=Create/modify external users only
Permission255=Modify other users password Permission255=Modify other users password
Permission256=Delete or disable other users Permission256=Delete or disable other users
Permission262=Extend access to all third parties (not only third parties that user is a sale representative). Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc). Not effective for projects (only rules on project permissions, visibility and assignement matters). Permission262=Extend access to all third parties (not only third parties that user is a sale representative).<br>Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc).<br>Not effective for projects (only rules on project permissions, visibility and assignement matters).
Permission271=Read CA Permission271=Read CA
Permission272=Read invoices Permission272=Read invoices
Permission273=Issue invoices Permission273=Issue invoices

View File

@ -74,7 +74,11 @@ ResultOfMailSending=Result of mass EMail sending
NbSelected=Nb selected NbSelected=Nb selected
NbIgnored=Nb ignored NbIgnored=Nb ignored
NbSent=Nb sent NbSent=Nb sent
ContactsWithThirdpartyFilter=Contact with customer filters ConfirmUnvalidateEmailing=Are you sure you want to change email <b>%s</b> to draft status?
MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters
MailingModuleDescContactsByCompanyCategory=Contacts by third party category
MailingModuleDescContactsByCategory=Contacts by categories
MailingModuleDescContactsByFunction=Contacts by position
# Libelle des modules de liste de destinataires mailing # Libelle des modules de liste de destinataires mailing
LineInFile=Line %s in file LineInFile=Line %s in file

View File

@ -58,7 +58,7 @@ SellingPrice=Selling price
SellingPriceHT=Selling price (net of tax) SellingPriceHT=Selling price (net of tax)
SellingPriceTTC=Selling price (inc. tax) SellingPriceTTC=Selling price (inc. tax)
CostPriceDescription=This price (net of tax) can be used to store the average amount this product cost to your company. It may be any price you calculate yourself, for example from the average buying price plus average production and distribution cost. CostPriceDescription=This price (net of tax) can be used to store the average amount this product cost to your company. It may be any price you calculate yourself, for example from the average buying price plus average production and distribution cost.
CostPriceUsage=In a future version, this value could be used for margin calculation. CostPriceUsage=This value could be used for margin calculation.
SoldAmount=Sold amount SoldAmount=Sold amount
PurchasedAmount=Purchased amount PurchasedAmount=Purchased amount
NewPrice=New price NewPrice=New price
@ -256,4 +256,4 @@ VolumeUnits=Volume unit
SizeUnits=Size unit SizeUnits=Size unit
DeleteProductBuyPrice=Delete buying price DeleteProductBuyPrice=Delete buying price
ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price? ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price?
SubProduct=Sub product

View File

@ -96,6 +96,7 @@ ValidateProject=Validate projet
ConfirmValidateProject=Are you sure you want to validate this project? ConfirmValidateProject=Are you sure you want to validate this project?
CloseAProject=Close project CloseAProject=Close project
ConfirmCloseAProject=Are you sure you want to close this project? ConfirmCloseAProject=Are you sure you want to close this project?
AlsoCloseAProject=Also close project (keep it open if you still need to follow production tasks on it)
ReOpenAProject=Open project ReOpenAProject=Open project
ConfirmReOpenAProject=Are you sure you want to re-open this project? ConfirmReOpenAProject=Are you sure you want to re-open this project?
ProjectContact=Project contacts ProjectContact=Project contacts
@ -121,7 +122,7 @@ CloneProjectFiles=Clone project joined files
CloneTaskFiles=Clone task(s) joined files (if task(s) cloned) CloneTaskFiles=Clone task(s) joined files (if task(s) cloned)
CloneMoveDate=Update project/tasks dates from now? CloneMoveDate=Update project/tasks dates from now?
ConfirmCloneProject=Are you sure to clone this project? ConfirmCloneProject=Are you sure to clone this project?
ProjectReportDate=Change task date according project start date ProjectReportDate=Change task dates according to new project start date
ErrorShiftTaskDate=Impossible to shift task date according to new project start date ErrorShiftTaskDate=Impossible to shift task date according to new project start date
ProjectsAndTasksLines=Projects and tasks ProjectsAndTasksLines=Projects and tasks
ProjectCreatedInDolibarr=Project %s created ProjectCreatedInDolibarr=Project %s created

View File

@ -993,9 +993,10 @@ function top_httphead()
* @param array $arrayofjs Array of complementary js files * @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files * @param array $arrayofcss Array of complementary css files
* @param int $disablejmobile Disable jmobile * @param int $disablejmobile Disable jmobile
* @param int $disablenofollow Disable no follow tag
* @return void * @return void
*/ */
function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0) function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
{ {
global $user, $conf, $langs, $db; global $user, $conf, $langs, $db;
@ -1017,13 +1018,13 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print "<head>\n"; print "<head>\n";
if (GETPOST('dol_basehref')) print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref')).'">'."\n"; if (GETPOST('dol_basehref')) print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref')).'">'."\n";
// Displays meta // Displays meta
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Do not index print '<meta name="robots" content="noindex'.($disablenofollow?'':',nofollow').'">'."\n"; // Do not index
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'; // Scale for mobile device print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'; // Scale for mobile device
print '<meta name="author" content="Dolibarr Development Team">'."\n"; print '<meta name="author" content="Dolibarr Development Team">'."\n";
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";

View File

@ -120,6 +120,7 @@ $sql = "SELECT";
if ($agentid > 0) $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($agentid > 0) $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
$sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,";
$sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(d.total_ht) as selling_price,";
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ; $sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -171,6 +172,11 @@ if ($result)
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,''); print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,'');
if ($conf->global->MARGIN_TYPE == "1")
$labelcostprice=$langs->trans('BuyingPrice');
else // value is 'costprice' or 'pmp'
$labelcostprice=$langs->trans('CostPrice');
$i = 0; $i = 0;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
@ -181,7 +187,7 @@ if ($result)
print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"u.lastname","","&amp;agentid=".$agentid,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"u.lastname","","&amp;agentid=".$agentid,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);

View File

@ -179,6 +179,11 @@ if ($result) {
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
if ($conf->global->MARGIN_TYPE == "1")
$labelcostprice=$langs->trans('BuyingPrice');
else // value is 'costprice' or 'pmp'
$labelcostprice=$langs->trans('CostPrice');
$moreforfilter=''; $moreforfilter='';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
@ -189,11 +194,7 @@ if ($result) {
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "f.ref", "", $options, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "f.ref", "", $options, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "", "", $options, 'width=20%', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "", "", $options, 'width=20%', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("UnitPriceHT"), $_SERVER["PHP_SELF"], "d.subprice", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("UnitPriceHT"), $_SERVER["PHP_SELF"], "d.subprice", "", $options, 'align="right"', $sortfield, $sortorder);
if ($conf->global->MARGIN_TYPE == "1") { print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("BuyingPrice"), $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $options, 'align="right"', $sortfield, $sortorder);
} else {
print_liste_field_titre($langs->trans("CostPrice"), $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $options, 'align="right"', $sortfield, $sortorder);
}
print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"], "d.total_ht", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"], "d.total_ht", "", $options, 'align="right"', $sortfield, $sortorder);

View File

@ -173,6 +173,7 @@ $sql = "SELECT";
$sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; if ($client) $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,";
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -207,6 +208,11 @@ if ($result)
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,''); print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,'');
if ($conf->global->MARGIN_TYPE == "1")
$labelcostprice=$langs->trans('BuyingPrice');
else // value is 'costprice' or 'pmp'
$labelcostprice=$langs->trans('CostPrice');
$i = 0; $i = 0;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
@ -218,7 +224,7 @@ if ($result)
else else
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&amp;socid=".$socid,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&amp;socid=".$socid,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder);
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&amp;socid=".$socid,'align="right"',$sortfield,$sortorder);

View File

@ -109,7 +109,7 @@ function marges_prepare_head()
* @param float $localtax2_tx Vat rate special 2 (not used) * @param float $localtax2_tx Vat rate special 2 (not used)
* @param int $fk_pa Id of buying price (prefer set this to 0 and provide $paht instead. With id, buying price may have change) * @param int $fk_pa Id of buying price (prefer set this to 0 and provide $paht instead. With id, buying price may have change)
* @param float $paht Buying price without tax * @param float $paht Buying price without tax
* @return array Array of margin info * @return array Array of margin info (buying price, marge rate, marque rate)
*/ */
function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht) function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht)
{ {
@ -134,7 +134,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta
} }
else else
{ {
$paht_ret = $paht; $paht_ret = $paht;
} }
// Calculate selling unit price including line discount // Calculate selling unit price including line discount

View File

@ -169,6 +169,7 @@ $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,";
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -203,6 +204,11 @@ if ($result)
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&amp;id=".$id,$sortfield,$sortorder,'',$num,$num,''); print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&amp;id=".$id,$sortfield,$sortorder,'',$num,$num,'');
if ($conf->global->MARGIN_TYPE == "1")
$labelcostprice=$langs->trans('BuyingPrice');
else // value is 'costprice' or 'pmp'
$labelcostprice=$langs->trans('CostPrice');
$moreforfilter=''; $moreforfilter='';
$i = 0; $i = 0;
@ -215,9 +221,11 @@ if ($result)
print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&amp;id=".$id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&amp;id=".$id,'align="center"',$sortfield,$sortorder);
} }
else else
{
print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&amp;id=".$id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&amp;id=".$id,'',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&amp;id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&amp;id=".$id,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&amp;id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&amp;id=".$id,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&amp;id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&amp;id=".$id,'align="right"',$sortfield,$sortorder);
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&amp;id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&amp;id=".$id,'align="right"',$sortfield,$sortorder);

View File

@ -1149,7 +1149,7 @@ else
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Create") . '">'; print '<input type="submit" class="button" value="' . $langs->trans("Create") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print ' &nbsp; &nbsp; ';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">'; print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>'; print '</div>';

View File

@ -700,6 +700,7 @@ if ($id > 0 || $ref)
if ($user->rights->produit->creer || $user->rights->service->creer) if ($user->rights->produit->creer || $user->rights->service->creer)
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=add_price&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>"; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=add_price&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>";
print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=ask_remove_pf&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"),'disable.png').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=ask_remove_pf&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"),'disable.png').'</a>';
} }

View File

@ -342,7 +342,7 @@ print '<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="addline">'; print '<input type="hidden" name="action" value="addline">';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive-no-max">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
//print '<div class="tagtable centpercent">'; //print '<div class="tagtable centpercent">';

View File

@ -39,6 +39,41 @@ $langs->load("orders");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service'); $result=restrictedArea($user,'produit|service');
$sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'alpha');
$sall = GETPOST('search_all', 'alpha');
$sdate = GETPOST('search_date', 'alpha');
$page = GETPOST('page', 'int');
$sproduct = GETPOST('sproduct', 'int');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
if (!$sortorder) $sortorder = 'DESC';
if (!$sortfield) $sortfield = 'cf.date_creation';
$page = GETPOST("page");
if ($page < 0) $page = 0;
$offset = $limit * $page;
/*
* Actions
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$sall="";
$sref="";
$snom="";
$suser="";
$sttc="";
$sdate='';
$sproduct=0;
}
/* /*
@ -65,21 +100,6 @@ $head[1][2] = 'replenishorders';
dol_fiche_head($head, 'replenishorders', '', 0, ''); dol_fiche_head($head, 'replenishorders', '', 0, '');
$commandestatic = new CommandeFournisseur($db); $commandestatic = new CommandeFournisseur($db);
$sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'int');
$sall = GETPOST('search_all', 'alpha');
$sdate = GETPOST('search_date', 'alpha');
$page = GETPOST('page', 'int');
$sproduct = GETPOST('sproduct', 'int');
$sortorder = GETPOST('sortorder', 'alpha');
$sortfield = GETPOST('sortfield', 'alpha');
if (!$sortorder) $sortorder = 'DESC';
if (!$sortfield) $sortfield = 'cf.date_creation';
$offset = $conf->liste_limit * $page ;
$sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,'; $sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,';
$sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,'; $sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
@ -101,25 +121,10 @@ if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
if (!$user->rights->societe->client->voir && !$socid) { if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id; $sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
} }
if ($sref) { if ($sref) $sql .= natural_search('cf.ref', $sref);
//natural search if ($snom) $sql .= natural_search('s.nom', $snom);
$scrit = explode(' ', $sref); if ($suser) $sql .= natural_search('u.login', $suser);
foreach ($scrit as $crit) { if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
$sql .= ' AND cf.ref LIKE "%' . $db->escape($crit) . '%"';
}
}
if ($snom) {
$scrit = explode(' ', $snom);
foreach ($scrit as $crit) {
$sql .= ' AND s.nom LIKE "%' . $db->escape($crit) . '%"';
}
}
if ($suser) {
$sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"';
}
if ($sttc) {
$sql .= ' AND cf.total_ttc = ' . price2num($sttc);
}
if ($sdate) if ($sdate)
{ {
if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int'))
@ -132,21 +137,15 @@ if ($sdate)
} }
$sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'";
} }
if ($sall) { if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
$sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
}
if (!empty($socid)) {
$sql .= ' AND s.rowid = ' . $socid;
}
if (GETPOST('statut', 'int')) { if (GETPOST('statut', 'int')) {
$sql .= ' AND fk_statut = ' . GETPOST('statut', 'int'); $sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
} }
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut'; $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($conf->liste_limit+1, $offset); $sql .= $db->plimit($limit+1, $offset);
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);
@ -242,9 +241,8 @@ if ($resql)
$form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '').
'</td>'. '</td>'.
'<td class="liste_titre" align="right">'; '<td class="liste_titre" align="right">';
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png'; $searchpitco=$form->showFilterAndCheckAddButtons(0);
$value = dol_escape_htmltag($langs->trans('Search')); print $searchpitco;
print '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="' . $value . '" title="' . $value . '">'.
'</td>'. '</td>'.
'</tr>'; '</tr>';

View File

@ -427,7 +427,7 @@ print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) print '<td class="liste_total"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>'; if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) print '<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';

View File

@ -427,7 +427,7 @@ print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print '<td class="liste_total"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>'; if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print '<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';

View File

@ -286,11 +286,23 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorShiftTaskDate").':'.$object->error, $langs->trans("ErrorShiftTaskDate").':'.$object->errors, 'errors'); setEventMessages($langs->trans("ErrorShiftTaskDate").':'.$object->error, $object->errors, 'errors');
} }
} }
} }
// Check if we must change status
if (GETPOST('closeproject'))
{
$resclose = $object->setClose($user);
if ($resclose < 0)
{
$error++;
setEventMessages($langs->trans("FailedToCloseProject").':'.$object->error, $object->errors, 'errors');
}
}
if ($error) if ($error)
{ {
$db->rollback(); $db->rollback();
@ -303,6 +315,7 @@ if (empty($reshook))
if (GETPOST('socid','int') > 0) $object->fetch_thirdparty(GETPOST('socid','int')); if (GETPOST('socid','int') > 0) $object->fetch_thirdparty(GETPOST('socid','int'));
else unset($object->thirdparty); else unset($object->thirdparty);
} }
} }
// Build doc // Build doc
@ -594,6 +607,11 @@ if ($action == 'create' && $user->rights->projet->creer)
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} }
else
{
print ' &nbsp; &nbsp; ';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
}
print '</div>'; print '</div>';
print '</form>'; print '</form>';
@ -730,7 +748,11 @@ elseif ($object->id > 0)
// Opportunity status // Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td>'; print '<tr><td>'.$langs->trans("OpportunityStatus").'</td>';
print '<td>'; print '<td>';
print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1); print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle');
print '<div id="divtocloseproject" class="inline-block valign" style="display: none;"> &nbsp; &nbsp; ';
print '<input type="checkbox" id="inputcloseproject" name="closeproject" /> ';
print $langs->trans("AlsoCloseAProject");
print '</div>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -843,12 +865,12 @@ elseif ($object->id > 0)
// Opportunity percent // Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>'; print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %'; if (strcmp($object->opp_percent,'')) print price($object->opp_percent,0,$langs,1,0).' %';
print '</td></tr>'; print '</td></tr>';
// Opportunity Amount // Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>'; print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($object->opp_amount,'')) print price($object->opp_amount,0,$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
} }
@ -865,7 +887,7 @@ elseif ($object->id > 0)
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($object->budget_amount, '')) print price($object->budget_amount,0,$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
@ -915,27 +937,49 @@ elseif ($object->id > 0)
print '</form>'; print '</form>';
// Change probability from status // Change probability from status
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
$defaultcheckedwhenoppclose=1;
if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
print '<!-- Javascript to manage opportunity status change -->';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
function change_percent() function change_percent()
{ {
var element = jQuery("#opp_status option:selected"); var element = jQuery("#opp_status option:selected");
var defaultpercent = element.attr("defaultpercent"); var defaultpercent = element.attr("defaultpercent");
var elemcode = element.attr("elemcode"); var defaultcloseproject = '.$defaultcheckedwhenoppclose.';
/* Change percent of default percent of new status is higher */ var elemcode = element.attr("elemcode");
if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent)) var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
{
if (jQuery("#opp_percent").val() != \'\' && ! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\');
jQuery("#opp_percent").val(defaultpercent);
} console.log("We select "+elemcode);
} if (elemcode == \'LOST\') defaultcloseproject = 1;
/*init_myfunc();*/ jQuery("#divtocloseproject").show();
jQuery("#opp_status").change(function() { if (defaultcloseproject) jQuery("#inputcloseproject").prop("checked", true);
change_percent(); else jQuery("#inputcloseproject").prop("checked", false);
});
/* Make close project visible or not */
if (elemcode == \'WON\' || elemcode == \'LOST\')
{
jQuery("#divtocloseproject").show();
}
else
{
jQuery("#divtocloseproject").hide();
}
/* Change percent of default percent of new status is higher */
if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent))
{
if (jQuery("#opp_percent").val() != \'\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+oldpercent+\' %\');
jQuery("#opp_percent").val(defaultpercent);
}
}
jQuery("#opp_status").change(function() {
change_percent();
});
}); });
</script>'; </script>';
} }

View File

@ -773,7 +773,7 @@ class Project extends CommonObject
* Close a project * Close a project
* *
* @param User $user User that close project * @param User $user User that close project
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0 if already closed, >0 if OK
*/ */
function setClose($user) function setClose($user)
{ {
@ -828,6 +828,8 @@ class Project extends CommonObject
return -1; return -1;
} }
} }
return 0;
} }
/** /**

View File

@ -817,8 +817,8 @@ foreach ($listofreferent as $key => $value)
} }
else if ($element_doc === 'invoice_supplier') { else if ($element_doc === 'invoice_supplier') {
$element_doc='facture_fournisseur'; $element_doc='facture_fournisseur';
$filename = get_exdir($element->id,2,0,0,$this,'product').dol_sanitizeFileName($element->ref); $filename = get_exdir($element->id,2,0,0,$element,'product').dol_sanitizeFileName($element->ref);
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2,0,0,null,'invoice_supplier').dol_sanitizeFileName($element->ref); $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2,0,0,$element,'invoice_supplier').dol_sanitizeFileName($element->ref);
} }
print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>'; print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>';

View File

@ -54,7 +54,7 @@ if (GETPOST('actioncode','array'))
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
$search_agenda_label=GETPOST('search_agenda_label'); $search_agenda_label=GETPOST('search_agenda_label');

View File

@ -228,8 +228,8 @@ if (GETPOST("action") == 'gotodemo')
*/ */
$head=''; $head='';
$head.='<meta name="keywords" content="dolibarr,demo,online,demonstration,example,test,web,erp,crm,demos,online">'."\n"; $head.='<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'."\n";
$head.='<meta name="description" content="Dolibarr simple ERP/CRM demo. You can test here several profiles of Dolibarr ERP/CRM demos.">'."\n"; $head.='<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'."\n";
$head.='<style type="text/css">'."\n"; $head.='<style type="text/css">'."\n";
$head.='.body { font: 12px arial,verdana,helvetica !important; }'."\n"; $head.='.body { font: 12px arial,verdana,helvetica !important; }'."\n";
$head.='.CTable { $head.='.CTable {
@ -244,10 +244,6 @@ border: 1px solid #bbb;
border-radius: 8px; border-radius: 8px;
-moz-border-radius: 8px; -moz-border-radius: 8px;
-moz-box-shadow: 4px 4px 4px #EEE;
-webkit-box-shadow: 4px 4px 4px #EEE;
box-shadow: 4px 4px 4px #EEE;
background: -webkit-linear-gradient(bottom, rgb(255,255,255) 85%, rgb(255,255,255) 100%); background: -webkit-linear-gradient(bottom, rgb(255,255,255) 85%, rgb(255,255,255) 100%);
} }
@ -316,7 +312,7 @@ print "\n";
print '<table style="font-size:14px;" class="centpercent" summary="Main table for Dolibarr demos">'; print '<table style="font-size:14px;" class="centpercent" summary="Main table for Dolibarr demos">';
print '<tr><td>'; print '<tr><td>';
print '<div class="center"><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" alt="Dolibarr logo"></div><br>'; print '<div class="center"><a alt="Official portal of your ERP CRM application" targe="_blank" href="https://www.dolibarr.org"><img class="demologo" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" alt="Dolibarr logo"></a></div><br>';
print '<br>'; print '<br>';
print '<div style="text-align: justify;">'.$langs->trans("DemoDesc").'</div><br>'; print '<div style="text-align: justify;">'.$langs->trans("DemoDesc").'</div><br>';
@ -358,7 +354,7 @@ foreach ($demoprofiles as $profilearray)
print '<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.'">'."\n"; print '<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.'">'."\n";
print '<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.'">'."\n"; print '<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.'">'."\n";
print '<table summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" style="font-size:14px;" width="100%" class="CTable CTableRow'.($i%2==0?'1':'0').'">'."\n"; print '<table summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" style="font-size:14px;" class="centpercent CTable CTableRow'.($i%2==0?'1':'0').'">'."\n";
// Title // Title
print '<tr>'; print '<tr>';
print '<td width="130" id="a1'.$profilearray['key'].'" class="'.(empty($profilearray['url'])?'modulelineshow cursorpointer':'nomodulelines').'"><a href="'.$urlwithmod.'" class="'.(empty($profilearray['url'])?'modulelineshow':'nomodulelines').'"><img class="demothumb" src="'.$profilearray['icon'].'" alt="Demo '.$profilearray['label'].'"></a></td>'; print '<td width="130" id="a1'.$profilearray['key'].'" class="'.(empty($profilearray['url'])?'modulelineshow cursorpointer':'nomodulelines').'"><a href="'.$urlwithmod.'" class="'.(empty($profilearray['url'])?'modulelineshow':'nomodulelines').'"><img class="demothumb" src="'.$profilearray['icon'].'" alt="Demo '.$profilearray['label'].'"></a></td>';
@ -481,7 +477,7 @@ function llxHeaderVierge($title, $head = "")
top_htmlhead($head,$title); top_htmlhead($head,$title);
print '<body style="padding: 20px;">'."\n"; print '<body class="demobody demobackground"><div style="padding: 20px;" class="demobackgrounddiv">'."\n";
} }
/** /**
@ -494,7 +490,7 @@ function llxFooterVierge()
printCommonFooter('public'); printCommonFooter('public');
print "\n"; print "\n";
print "</body>\n"; print "</div></body>\n";
print "</html>\n"; print "</html>\n";
} }

View File

@ -460,7 +460,7 @@ class Dolresource extends CommonObject
$extrafields=new ExtraFields($this->db); $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (is_array($extralabels) && count($extralabels)>0) { if (is_array($extralabels) && count($extralabels)>0) {
foreach($extralabels as $label=>$code) { foreach($extralabels as $code=>$label) {
$sql.= " ef.".$code." as extra_".$code.","; $sql.= " ef.".$code." as extra_".$code.",";
} }
} }

View File

@ -119,12 +119,15 @@ $arrayfields = array(
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
foreach ( $extrafields->attribute_label as $key => $val ) { foreach ( $extrafields->attribute_label as $key => $val ) {
$arrayfields["ef." . $key] = array( $typeofextrafield=$extrafields->attribute_type[$key];
'label' => $extrafields->attribute_label[$key], if ($typeofextrafield!='separate') {
'checked' => $extrafields->attribute_list[$key], $arrayfields["ef." . $key] = array(
'position' => $extrafields->attribute_pos[$key], 'label' => $extrafields->attribute_label[$key],
'enabled' => $extrafields->attribute_perms[$key] 'checked' => $extrafields->attribute_list[$key],
); 'position' => $extrafields->attribute_pos[$key],
'enabled' => $extrafields->attribute_perms[$key]
);
}
} }
} }

View File

@ -41,7 +41,7 @@ if (GETPOST('actioncode','array'))
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
$search_agenda_label=GETPOST('search_agenda_label'); $search_agenda_label=GETPOST('search_agenda_label');

View File

@ -503,10 +503,9 @@ class Societe extends CommonObject
} }
else else
{ {
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name); // duplicate on a field (code or profid or ...)
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name);
$result=-1; $result=-1;
} }
else else

View File

@ -88,7 +88,7 @@ $sortorder=GETPOST("sortorder",'alpha');
$page=GETPOST("page",'int'); $page=GETPOST("page",'int');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom"; if (! $sortfield) $sortfield="s.nom";
if ($page == -1) { $page = 0 ; } if (empty($page) || $page == -1) { $page = 0 ; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -240,7 +240,7 @@ if (empty($reshook))
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->update($object->id, $user); $result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
$action=''; $action='';
} }
} }
@ -505,7 +505,7 @@ foreach ($search_array_options as $key => $val)
$crit=$val; $crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// Show delete result message // Show delete result message
if (GETPOST('delsoc')) if (GETPOST('delsoc'))
@ -619,9 +619,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_f
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -838,9 +838,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked']))
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key]; $typeofextrafield=$extrafields->attribute_type[$key];
@ -895,7 +895,7 @@ while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
$companystatic->id=$obj->rowid; $companystatic->id=$obj->rowid;
$companystatic->name=$obj->name; $companystatic->name=$obj->name;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
@ -906,7 +906,7 @@ while ($i < min($num, $limit))
$companystatic->code_fournisseur=$obj->code_fournisseur; $companystatic->code_fournisseur=$obj->code_fournisseur;
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
$companystatic->name_alias=$obj->name_alias; $companystatic->name_alias=$obj->name_alias;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -948,12 +948,12 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['s.zip']['checked'])) if (! empty($arrayfields['s.zip']['checked']))
{ {
print "<td>".$obj->zip."</td>\n"; print "<td>".$obj->zip."</td>\n";
} }
// State // State
if (! empty($arrayfields['state.nom']['checked'])) if (! empty($arrayfields['state.nom']['checked']))
{ {
print "<td>".$obj->state_name."</td>\n"; print "<td>".$obj->state_name."</td>\n";
} }
// Country // Country
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {

View File

@ -514,8 +514,8 @@ if (empty($reshook))
} }
else else
{ {
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case
if($result == -3) { {
$duplicate_code_error = true; $duplicate_code_error = true;
$object->code_fournisseur = null; $object->code_fournisseur = null;
$object->code_client = null; $object->code_client = null;
@ -1308,11 +1308,16 @@ else
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="create" value="'.$langs->trans('AddThirdParty').'">'; print '<input type="submit" class="button" name="create" value="'.$langs->trans('AddThirdParty').'">';
if ($backtopage) if (! empty($backtopage))
{ {
print ' &nbsp; '; print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
} }
else
{
print ' &nbsp; &nbsp; ';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
}
print '</div>'."\n"; print '</div>'."\n";
print '</form>'."\n"; print '</form>'."\n";
@ -1898,7 +1903,7 @@ else
print '<div align="center">'; print '<div align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
@ -2517,7 +2522,7 @@ else
$var=true; $var=true;
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang); print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
@ -158,26 +158,26 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
// Set text color to black or white // Set text color to black or white
$tmppart=explode(',',$colorbackhmenu1); $tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
else $colortextbackhmenu='000000'; else $colortextbackhmenu='000000';
$tmppart=explode(',',$colorbackvmenu1); $tmppart=explode(',',$colorbackvmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
else { $colortextbackvmenu='000000'; } else { $colortextbackvmenu='000000'; }
$tmppart=explode(',',$colorbacktitle1); $tmppart=explode(',',$colorbacktitle1);
if ($colortexttitle == '') if ($colortexttitle == '')
{ {
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 360) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; } else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
} }
$tmppart=explode(',',$colorbacktabcard1); $tmppart=explode(',',$colorbacktabcard1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
else { $colortextbacktab='111111'; } else { $colortextbacktab='111111'; }
@ -254,7 +254,7 @@ a.tab { font-weight: bold !important; }
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; } a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); } a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); }
a.commonlink { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: none; } a.commonlink { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: none; }
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
background-color: #FFF; background-color: #FFF;
@ -284,7 +284,7 @@ textarea.cke_source:focus
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
font-size: <?php print $fontsize ?>px; font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
border: 1px solid #C0C0C0; border: 1px solid #C0C0C0;
/* v6 border: none; /* v6 border: none;
border-bottom: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0;
@ -309,7 +309,7 @@ textarea {
border: solid 1px rgba(0,0,0,.3); border: solid 1px rgba(0,0,0,.3);
border-top:solid 1px rgba(0,0,0,.3); border-top:solid 1px rgba(0,0,0,.3);
border-bottom:solid 1px rgba(0,0,0,.2); border-bottom:solid 1px rgba(0,0,0,.2);
padding:4px; padding:4px;
margin-left:0px; margin-left:0px;
margin-bottom:1px; margin-bottom:1px;
@ -621,12 +621,12 @@ div.myavailability {
overflow-y: hidden; overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar; -ms-overflow-style: -ms-autohiding-scrollbar;
}*/ }*/
/* Style used for most tables */ /* Style used for most tables */
.div-table-responsive, .div-table-responsive-no-min { .div-table-responsive, .div-table-responsive-no-min {
overflow-x: auto; overflow-x: auto;
min-height: 0.01%; min-height: 0.01%;
} }
/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ /* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */
div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min { div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min {
overflow-x: auto; overflow-x: auto;
} }
@ -715,20 +715,20 @@ div.fiche>form>div.div-table-responsive {
.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { .border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
height: 40px !important; height: 40px !important;
} }
.quatrevingtpercent, .inputsearch { .quatrevingtpercent, .inputsearch {
width: 95%; width: 95%;
} }
input, input[type=text], input[type=password], select, textarea { input, input[type=text], input[type=password], select, textarea {
min-width: 20px; min-width: 20px;
min-height: 1.4em; min-height: 1.4em;
line-height: 1.4em; line-height: 1.4em;
padding: .4em .1em; padding: .4em .1em;
border: 1px solid #BBB; border: 1px solid #BBB;
/* max-width: inherit; why this ? */ /* max-width: inherit; why this ? */
} }
.hideonsmartphone { display: none; } .hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
@ -747,20 +747,20 @@ div.fiche>form>div.div-table-responsive {
.minwidth500imp { min-width: 50px !important; } .minwidth500imp { min-width: 50px !important; }
.titlefield { width: auto; } .titlefield { width: auto; }
.titlefieldcreate { width: auto; } .titlefieldcreate { width: auto; }
#tooltip { #tooltip {
position: absolute; position: absolute;
width: <?php print dol_size(300,'width'); ?>px; width: <?php print dol_size(300,'width'); ?>px;
} }
/* intput, input[type=text], */ /* intput, input[type=text], */
select { select {
width: 98%; width: 98%;
min-width: 40px; min-width: 40px;
} }
div.divphotoref { div.divphotoref {
padding-right: 5px; padding-right: 5px;
} }
img.photoref, div.photoref { img.photoref, div.photoref {
border: none; border: none;
@ -772,7 +772,7 @@ div.fiche>form>div.div-table-responsive {
width: 20px; width: 20px;
object-fit: contain; object-fit: contain;
} }
} }
.linkobject { cursor: pointer; } .linkobject { cursor: pointer; }
<?php if (GETPOST("optioncss") == 'print') { ?> <?php if (GETPOST("optioncss") == 'print') { ?>
@ -1239,7 +1239,7 @@ div.menu_titre {
padding-top: 4px; padding-top: 4px;
padding-bottom: 4px; padding-bottom: 4px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.mainmenuaspan .mainmenuaspan
{ {
@ -1423,7 +1423,7 @@ form#login {
} }
.login_table_title { .login_table_title {
max-width: 530px; max-width: 530px;
color: #888888; color: #888888 !important;
text-shadow: 1px 1px 1px #FFF; text-shadow: 1px 1px 1px #FFF;
} }
.login_table label { .login_table label {
@ -1442,7 +1442,7 @@ form#login {
-moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); -moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15);
-webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); -webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15);
box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15);
/*-moz-box-shadow: 3px 2px 20px #CCC; /*-moz-box-shadow: 3px 2px 20px #CCC;
-webkit-box-shadow: 3px 2px 20px #CCC; -webkit-box-shadow: 3px 2px 20px #CCC;
box-shadow: 3px 2px 20px #CCC;*/ box-shadow: 3px 2px 20px #CCC;*/
@ -1646,7 +1646,7 @@ a.vsmenu.addbookmarkpicto {
{ {
/* border-bottom: 1px solid #BBB; */ /* border-bottom: 1px solid #BBB; */
} }
div.blockvmenusearchphone div.blockvmenusearchphone
{ {
border-bottom: none !important; border-bottom: none !important;
} }
@ -2511,8 +2511,8 @@ div.liste_titre_bydiv .divsearchfield {
padding: 2px 1px 2px 0px; /* t r b l */ padding: 2px 1px 2px 0px; /* t r b l */
} }
tr.box_titre .nobordernopadding td { tr.box_titre .nobordernopadding td {
padding: 0px ! important; padding: 0px ! important;
} }
table.nobordernopadding { table.nobordernopadding {
border-collapse: collapse !important; border-collapse: collapse !important;
@ -2778,6 +2778,9 @@ tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair
padding: 5px 2px 5px 3px; padding: 5px 2px 5px 3px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
form.pair, form.impair {
font-weight: normal;
}
form.tagtr:last-of-type div.tagtd, tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { form.tagtr:last-of-type div.tagtd, tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td {
border-bottom: 0px !important; border-bottom: 0px !important;
} }
@ -2807,7 +2810,7 @@ div.liste_titre_bydiv {
border-top-width: <?php echo $borderwith ?>px; border-top-width: <?php echo $borderwith ?>px;
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>); border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
border-top-style: solid; border-top-style: solid;
border-collapse: collapse; border-collapse: collapse;
display: table; display: table;
padding: 2px 0px 2px 0; padding: 2px 0px 2px 0;
@ -3419,7 +3422,7 @@ td.hidden {
border-bottom: 1px solid #888; border-bottom: 1px solid #888;
background: #eee; background: #eee;
} }
.websitebar .button, .websitebar .buttonDelete .websitebar .button, .websitebar .buttonDelete
{ {
padding: 2px 5px 3px 5px !important; padding: 2px 5px 3px 5px !important;
margin: 2px 4px 2px 4px !important; margin: 2px 4px 2px 4px !important;
@ -3428,7 +3431,7 @@ td.hidden {
.websiteselection { .websiteselection {
display: inline-block; display: inline-block;
padding-left: 10px; padding-left: 10px;
vertical-align: middle; vertical-align: middle;
line-height: 29px; line-height: 29px;
} }
.websitetools { .websitetools {
@ -4550,6 +4553,14 @@ img.demothumb {
margin-left: 10px; margin-left: 10px;
} }
.demobackground {
/*
background-image: url(/dolibarr_5.0/htdocs/theme/image-demo.jpg);
background-size: cover;
object-fit: contain;
*/
}
/* ============================================================================== */ /* ============================================================================== */

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -159,26 +159,26 @@ if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1;
// Set text color to black or white // Set text color to black or white
$tmppart=explode(',',$colorbackhmenu1); $tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
else $colortextbackhmenu='000000'; else $colortextbackhmenu='000000';
$tmppart=explode(',',$colorbackvmenu1); $tmppart=explode(',',$colorbackvmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
else { $colortextbackvmenu='000000'; } else { $colortextbackvmenu='000000'; }
$tmppart=explode(',',$colorbacktitle1); $tmppart=explode(',',$colorbacktitle1);
if ($colortexttitle == '') if ($colortexttitle == '')
{ {
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 260) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; }
} }
$tmppart=explode(',',$colorbacktabcard1); $tmppart=explode(',',$colorbacktabcard1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '');
if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
else { $colortextbacktab='111111'; } else { $colortextbacktab='111111'; }
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255') // Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
@ -254,7 +254,7 @@ a.tab { font-weight: bold !important; }
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; } a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); } a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); }
a.commonlink { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: none; } a.commonlink { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: none; }
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
background-color: #FDFDFD; background-color: #FDFDFD;
@ -525,7 +525,7 @@ div.divsearchfield {
margin-<?php print $left; ?>: 2px; margin-<?php print $left; ?>: 2px;
margin-top: 4px; margin-top: 4px;
margin-bottom: 4px; margin-bottom: 4px;
padding-left: 2px; padding-left: 2px;
} }
div.confirmmessage { div.confirmmessage {
padding-top: 6px; padding-top: 6px;
@ -539,8 +539,8 @@ div.myavailability {
} }
.checkallactions { .checkallactions {
vertical-align: top; vertical-align: top;
margin-top: 6px; margin-top: 6px;
margin-left: 4px; margin-left: 4px;
} }
.selectlimit, .marginrightonly { .selectlimit, .marginrightonly {
margin-right: 10px !important; margin-right: 10px !important;
@ -598,12 +598,12 @@ div.myavailability {
overflow-y: hidden; overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar; -ms-overflow-style: -ms-autohiding-scrollbar;
}*/ }*/
/* Style used for most tables */ /* Style used for most tables */
.div-table-responsive, .div-table-responsive-no-min { .div-table-responsive, .div-table-responsive-no-min {
overflow-x: auto; overflow-x: auto;
min-height: 0.01%; min-height: 0.01%;
} }
/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ /* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */
div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min { div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min {
overflow-x: auto; overflow-x: auto;
} }
@ -650,7 +650,7 @@ div.fiche>form>div.div-table-responsive {
.titlefield { width: 25%; } .titlefield { width: 25%; }
.titlefieldmiddle { width: 50%; } .titlefieldmiddle { width: 50%; }
.imgmaxwidth180 { max-width: 180px; } .imgmaxwidth180 { max-width: 180px; }
/* Force values for small screen 1400 */ /* Force values for small screen 1400 */
@media only screen and (max-width: 1400px) @media only screen and (max-width: 1400px)
@ -693,20 +693,20 @@ div.fiche>form>div.div-table-responsive {
.border tbody tr, .border tbody tr td, div.tabBar table.border tr { .border tbody tr, .border tbody tr td, div.tabBar table.border tr {
height: 40px !important; height: 40px !important;
} }
.quatrevingtpercent, .inputsearch { .quatrevingtpercent, .inputsearch {
width: 95%; width: 95%;
} }
input, input[type=text], input[type=password], select, textarea { input, input[type=text], input[type=password], select, textarea {
min-width: 20px; min-width: 20px;
min-height: 1.4em; min-height: 1.4em;
line-height: 1.4em; line-height: 1.4em;
padding: .4em .1em; padding: .4em .1em;
border: 1px solid #BBB; border: 1px solid #BBB;
/* max-width: inherit; why this */ /* max-width: inherit; why this */
} }
.hideonsmartphone { display: none; } .hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
@ -725,20 +725,20 @@ div.fiche>form>div.div-table-responsive {
.minwidth500imp { min-width: 50px !important; } .minwidth500imp { min-width: 50px !important; }
.titlefield { width: auto; } .titlefield { width: auto; }
.titlefieldcreate { width: auto; } .titlefieldcreate { width: auto; }
#tooltip { #tooltip {
position: absolute; position: absolute;
width: <?php print dol_size(300,'width'); ?>px; width: <?php print dol_size(300,'width'); ?>px;
} }
/* intput, input[type=text], */ /* intput, input[type=text], */
select { select {
width: 98%; width: 98%;
min-width: 40px; min-width: 40px;
} }
div.divphotoref { div.divphotoref {
padding-right: 5px; padding-right: 5px;
} }
img.photoref, div.photoref { img.photoref, div.photoref {
border: none; border: none;
@ -749,7 +749,7 @@ div.fiche>form>div.div-table-responsive {
height: 20px; height: 20px;
width: 20px; width: 20px;
object-fit: contain; object-fit: contain;
} }
} }
.linkobject { cursor: pointer; } .linkobject { cursor: pointer; }
<?php if (GETPOST("optioncss") == 'print') { ?> <?php if (GETPOST("optioncss") == 'print') { ?>
@ -802,7 +802,7 @@ td.showDragHandle {
<?php if (GETPOST("optioncss") != 'print') { ?> <?php if (GETPOST("optioncss") != 'print') { ?>
padding-left: 229px; padding-left: 229px;
padding-top: 12px; padding-top: 12px;
<?php } ?> <?php } ?>
} }
.side-nav { .side-nav {
@ -1017,7 +1017,7 @@ table.noborder tr.liste_titre td {
padding-right: 1px; padding-right: 1px;
padding-top: 1px; padding-top: 1px;
padding-bottom: 1px; padding-bottom: 1px;
width: 44px; width: 44px;
} }
div.attacharea { div.attacharea {
padding-top: 10px; padding-top: 10px;
@ -1033,7 +1033,7 @@ div.arearefnobottom {
padding-bottom: 4px; padding-bottom: 4px;
} }
div.heightref { div.heightref {
min-height: 80px; min-height: 80px;
} }
div.divphotoref { div.divphotoref {
padding-right: 20px; padding-right: 20px;
@ -1249,7 +1249,7 @@ div.tmenucenter
div.menu_titre { div.menu_titre {
padding-bottom: 2px; padding-bottom: 2px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.mainmenuaspan .mainmenuaspan
{ {
@ -1432,7 +1432,7 @@ form#login {
} }
.login_table_title { .login_table_title {
max-width: 530px; max-width: 530px;
color: #888888; color: #888888 !important;
text-shadow: 1px 1px 1px #FFF; text-shadow: 1px 1px 1px #FFF;
} }
.login_table label { .login_table label {
@ -1625,8 +1625,8 @@ div.vmenu, td.vmenu {
width: 202px; width: 202px;
} }
.menu_contenu { .menu_contenu {
padding-top: 4px; padding-top: 4px;
padding-bottom: 3px; padding-bottom: 3px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -2204,16 +2204,16 @@ span.butAction, span.butActionDelete {
text-shadow: none; text-shadow: none;
border-color: #555; border-color: #555;
cursor: not-allowed; cursor: not-allowed;
background-color: #f5f5f5; background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
background-repeat: repeat-x background-repeat: repeat-x
} }
.butActionDelete, .buttonDelete { .butActionDelete, .buttonDelete {
color: #ffffff !important; color: #ffffff !important;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
@ -2358,9 +2358,9 @@ table.liste, table.noborder, table.formdoc, div.noborder {
border-bottom-width: 1px; border-bottom-width: 1px;
border-bottom-color: #BBB; border-bottom-color: #BBB;
border-bottom-style: solid; border-bottom-style: solid;
margin: 0px 0px 8px 0px; margin: 0px 0px 8px 0px;
-moz-border-radius: 0.1em; -moz-border-radius: 0.1em;
-webkit-border-radius: 0.1em; -webkit-border-radius: 0.1em;
border-radius: 0.1em; border-radius: 0.1em;
@ -2618,7 +2618,7 @@ div.pagination li.paginationafterarrows {
margin-bottom: 1px; margin-bottom: 1px;
color: #202020; color: #202020;
min-height: 18px; /* seems to not be used */ min-height: 18px; /* seems to not be used */
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>; background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
} }
#GanttChartDIV { #GanttChartDIV {
@ -2651,6 +2651,9 @@ tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair
padding: 5px 2px 5px 3px; padding: 5px 2px 5px 3px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
form.pair, form.impair {
font-weight: normal;
}
tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td {
border-bottom: 0px !important; border-bottom: 0px !important;
} }
@ -2685,7 +2688,7 @@ div.liste_titre_bydiv {
border-top-width: <?php echo $borderwith ?>px; border-top-width: <?php echo $borderwith ?>px;
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>); border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
border-top-style: solid; border-top-style: solid;
box-shadow: none; box-shadow: none;
border-collapse: collapse; border-collapse: collapse;
display: table; display: table;
@ -2708,7 +2711,7 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
background: rgb(<?php echo $colorbacktitle1; ?>); background: rgb(<?php echo $colorbacktitle1; ?>);
<?php } ?> <?php } ?>
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
color: rgb(<?php echo $colortexttitle; ?>); color: rgb(<?php echo $colortexttitle; ?>);
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
border-bottom: 1px solid #FDFFFF; border-bottom: 1px solid #FDFFFF;
@ -2876,7 +2879,7 @@ span.dashboardlineko {
tr.box_titre { tr.box_titre {
height: 26px !important; height: 26px !important;
/* TO MATCH BOOTSTRAP */ /* TO MATCH BOOTSTRAP */
/*background: #ddd; /*background: #ddd;
color: #000 !important; */ color: #000 !important; */
@ -2891,7 +2894,7 @@ tr.box_titre {
<?php } else { ?> <?php } else { ?>
background: rgb(<?php echo $colorbacktitle1; ?>); background: rgb(<?php echo $colorbacktitle1; ?>);
<?php } ?> <?php } ?>
background-repeat: repeat-x; background-repeat: repeat-x;
color: rgb(<?php echo $colortexttitle; ?>); color: rgb(<?php echo $colortexttitle; ?>);
font-family: <?php print $fontlist ?>, sans-serif; font-family: <?php print $fontlist ?>, sans-serif;
@ -3324,7 +3327,7 @@ td.hidden {
border-bottom: 1px solid #888; border-bottom: 1px solid #888;
background: #eee; background: #eee;
} }
.websitebar .button, .websitebar .buttonDelete .websitebar .button, .websitebar .buttonDelete
{ {
padding: 2px 4px 2px 4px !important; padding: 2px 4px 2px 4px !important;
margin: 2px 4px 2px 4px !important; margin: 2px 4px 2px 4px !important;
@ -3333,7 +3336,7 @@ td.hidden {
.websiteselection { .websiteselection {
display: inline-block; display: inline-block;
padding-left: 10px; padding-left: 10px;
vertical-align: middle; vertical-align: middle;
line-height: 29px; line-height: 29px;
} }
.websitetools { .websitetools {
@ -4494,12 +4497,12 @@ img.demothumb {
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
.imgopensurveywizard, .imgautosize { width:95%; height: auto; } .imgopensurveywizard, .imgautosize { width:95%; height: auto; }
#tooltip { #tooltip {
position: absolute; position: absolute;
width: <?php print dol_size(350,'width'); ?>px; width: <?php print dol_size(350,'width'); ?>px;
} }
img.demothumb { img.demothumb {
box-shadow: 1px 1px 4px #BBB; box-shadow: 1px 1px 4px #BBB;
margin-right: 6px; margin-right: 6px;
@ -4516,7 +4519,7 @@ img.demothumb {
border-right: none; border-right: none;
border-left: none; border-left: none;
} }
} }
@ -4590,7 +4593,7 @@ img.demothumb {
div.mainmenu { div.mainmenu {
min-width: 20px; min-width: 20px;
} }
#tooltip { #tooltip {
position: absolute; position: absolute;
width: <?php print dol_size(300,'width'); ?>px; width: <?php print dol_size(300,'width'); ?>px;
@ -4600,7 +4603,7 @@ img.demothumb {
min-width: 0 !important; min-width: 0 !important;
} }
div.divphotoref { div.divphotoref {
padding-right: 5px; padding-right: 5px;
} }
img.photoref, div.photoref { img.photoref, div.photoref {
border: none; border: none;
@ -4612,7 +4615,7 @@ img.demothumb {
width: 20px; width: 20px;
object-fit: contain; object-fit: contain;
} }
} }

View File

@ -752,9 +752,10 @@ if (($action == 'create') || ($action == 'adduserldap'))
print '</td></tr>'; print '</td></tr>';
// Employee // Employee
$defaultemployee=1;
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Employee','employee',0).'</td><td>'; print '<td>'.$langs->trans('Employee').'</td><td>';
print $form->selectyesno("employee",(GETPOST('employee')?GETPOST('employee'):0),1); print $form->selectyesno("employee",(GETPOST('employee')!=''?GETPOST('employee'):$defaultemployee),1);
print '</td></tr>'; print '</td></tr>';
// Position/Job // Position/Job

View File

@ -127,6 +127,9 @@ class User extends CommonObject
public $dateemployment; // Define date of employment by company public $dateemployment; // Define date of employment by company
private $cache_childids;
/** /**
* Constructor de la classe * Constructor de la classe
* *
@ -2600,26 +2603,38 @@ class User extends CommonObject
} }
/** /**
* Return list of all child users id in herarchy (all sublevels). * Return list of all child users id in herarchy of current user (all sublevels).
* *
* @param int $addcurrentuser 1=Add also current user id to the list.
* @return array Array of user id lower than user. This overwrite this->users. * @return array Array of user id lower than user. This overwrite this->users.
* @see get_children * @see get_children
*/ */
function getAllChildIds() function getAllChildIds($addcurrentuser=0)
{ {
// Init this->users $childids=array();
$this->get_full_tree();
if (isset($this->cache_childids[$this->id]))
$idtoscan=$this->id; {
$childids=array(); $childids = $this->cache_childids[$this->id];
}
dol_syslog("Build childid for id = ".$idtoscan); else
foreach($this->users as $id => $val) {
{ // Init this->users
//var_dump($val['fullpath']); $this->get_full_tree();
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
} $idtoscan=$this->id;
dol_syslog("Build childid for id = ".$idtoscan);
foreach($this->users as $id => $val)
{
//var_dump($val['fullpath']);
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
}
}
$this->cache_childids[$this->id] = $childids;
if ($addcurrentuser) $childids[$this->id]=$this->id;
return $childids; return $childids;
} }

View File

@ -76,7 +76,7 @@ if ($user->id <> $id && ! $canreaduser) accessforbidden();
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0; } if (empty($page) || $page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -132,11 +132,11 @@ if ($object->id)
dol_fiche_head($head, 'document', $langs->trans("User"),0,'user'); dol_fiche_head($head, 'document', $langs->trans("User"),0,'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0; $totalsize=0;
@ -160,7 +160,7 @@ if ($object->id)
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
$modulepart = 'user'; $modulepart = 'user';
$permission = $user->rights->user->user->creer; $permission = $user->rights->user->user->creer;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.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
@ -43,7 +43,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
if ($page == -1) { $page = 0; } if (empty($page) || $page == -1) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -115,16 +115,16 @@ $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$nbtotalofrecords = $num; $nbtotalofrecords = $num;
$i = 0; $i = 0;
$param="&search_group=".urlencode($search_group)."&amp;sall=".urlencode($sall); $param="&search_group=".urlencode($search_group)."&amp;sall=".urlencode($sall);
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss; if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
$text = $langs->trans("ListOfGroups"); $text = $langs->trans("ListOfGroups");
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -133,26 +133,26 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
$moreforfilter=''; $moreforfilter='';
//$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; //$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -166,7 +166,7 @@ if ($resql)
print_liste_field_titre($langs->trans("NbOfUsers"),$_SERVER["PHP_SELF"],"nb",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("NbOfUsers"),$_SERVER["PHP_SELF"],"nb",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
@ -192,10 +192,10 @@ if ($resql)
$i++; $i++;
} }
print "</table>"; print "</table>";
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";
$db->free(); $db->free();
} }
else else

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* *
@ -50,7 +50,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
if ($page == -1) { $page = 0; } if (empty($page) || $page == -1) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -103,7 +103,7 @@ $arrayfields=array(
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
} }
@ -146,7 +146,7 @@ if (empty($reshook))
{ {
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{ {
@ -224,7 +224,7 @@ foreach ($search_array_options as $key => $val)
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }
@ -285,7 +285,7 @@ foreach ($search_array_options as $key => $val)
$crit=$val; $crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
$text = $langs->trans("ListOfUsers"); $text = $langs->trans("ListOfUsers");
@ -331,9 +331,9 @@ if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_t
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -368,7 +368,7 @@ if (! empty($arrayfields['u.gender']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['u.employee']['checked'])) if (! empty($arrayfields['u.employee']['checked']))
@ -408,9 +408,9 @@ if (! empty($arrayfields['u.datepreviouslogin']['checked']))
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key]; $typeofextrafield=$extrafields->attribute_type[$key];
@ -479,7 +479,7 @@ while ($i < min($num,$limit))
$userstatic->lastname=$obj->lastname; $userstatic->lastname=$obj->lastname;
$userstatic->employee=$obj->employee; $userstatic->employee=$obj->employee;
$userstatic->photo=$obj->photo; $userstatic->photo=$obj->photo;
$li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login'); $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login');
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -592,8 +592,8 @@ while ($i < min($num,$limit))
} }
} }
print '</td>'; print '</td>';
} }
// Date last login // Date last login
if (! empty($arrayfields['u.datelastlogin']['checked'])) if (! empty($arrayfields['u.datelastlogin']['checked']))
{ {
@ -604,13 +604,13 @@ while ($i < min($num,$limit))
{ {
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").'</td>'; print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").'</td>';
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
print '<td'; print '<td';
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);