+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+// Following var must be set:
+// $arrayofselected = array of id selected
+// $object
+// $objecttmp=new Propal($db);
+// $topicmail="SendSupplierProposalRef";
+// $modelmail="supplier_proposal_send";
+// $trackid='ord'.$object->id;
+
+
+if ($massaction == 'predelete')
+{
+ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
+}
+
+if ($massaction == 'presend')
+{
+ $langs->load("mails");
+
+ if (! GETPOST('cancel', 'alpha'))
+ {
+ $listofselectedid = array();
+ $listofselectedthirdparties = array();
+ $listofselectedref = array();
+ foreach ($arrayofselected as $toselectid)
+ {
+ $result = $objecttmp->fetch($toselectid);
+ if ($result > 0)
+ {
+ $listofselectedid[$toselectid] = $toselectid;
+ $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
+ if ($objecttmp->element == 'societe')
+ $thirdpartyid = $objecttmp->id;
+ if ($objecttmp->element == 'expensereport')
+ $thirdpartyid = $objecttmp->fk_user_author;
+ $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
+ $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
+ }
+ }
+ }
+
+ print '';
+
+ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
+ $formmail = new FormMail($db);
+
+ dol_fiche_head(null, '', '');
+
+ // Cree l'objet formulaire mail
+ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
+ $formmail = new FormMail($db);
+ $formmail->withform = -1;
+ $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
+
+ if ($formmail->fromtype === 'user')
+ {
+ $formmail->fromid = $user->id;
+ }
+ $formmail->trackid = $trackid;
+ if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
+ {
+ include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
+ $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid);
+ }
+ $formmail->withfrom = 1;
+ $liste = $langs->trans("AllRecipientSelected", count($arrayofselected));
+ if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts
+ {
+ $liste = array();
+ $thirdpartyid = array_shift($listofselectedthirdparties);
+ if ($objecttmp->element == 'expensereport')
+ {
+ $fuser = new User($db);
+ $fuser->fetch($thirdpartyid);
+ $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
+ }
+ else
+ {
+ $soc = new Societe($db);
+ $soc->fetch($thirdpartyid);
+ foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
+ $liste[$key] = $value;
+ }
+ }
+ $formmail->withtoreadonly = 0;
+ } else {
+ $formmail->withtoreadonly = 1;
+ }
+
+ $formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1);
+ $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste;
+ $formmail->withtofree = empty($liste)?1:0;
+ $formmail->withtocc = 1;
+ $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
+ $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
+ $formmail->withfile = 1;
+ // $formmail->withfile = 2; Not yet supported in mass action
+ $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document"
+ if ($objecttmp->element != 'societe') {
+ $formmail->withfile = $langs->trans("OnlyPDFattachmentSupported");
+ $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default
+ }
+ $formmail->withbody = 1;
+ $formmail->withdeliveryreceipt = 1;
+ $formmail->withcancel = 1;
+
+ // Make substitution in email content
+ $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
+ $substitutionarray['__EMAIL__'] = $sendto;
+ $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '
' : '';
+ $substitutionarray['__PERSONALIZED__'] = ''; // deprecated
+ $substitutionarray['__CONTACTCIVNAME__'] = '';
+
+ $parameters = array(
+ 'mode' => 'formemail'
+ );
+ complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
+
+ // Tableau des substitutions
+ $formmail->substit = $substitutionarray;
+
+ // Tableau des parametres complementaires du post
+ $formmail->param['action'] = $action;
+ $formmail->param['models'] = $modelmail;
+ $formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
+ $formmail->param['id'] = join(',', $arrayofselected);
+ // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
+ if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB)
+ {
+ $langs->load("errors");
+ print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
+ print ' - ' . $langs->trans("GoBack") . '';
+ $arrayofmassactions = array();
+ }
+ else
+ {
+ print $formmail->get_form();
+ }
+
+ dol_fiche_end();
+}
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 84b2413f396..27f5aa715d8 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -65,7 +65,10 @@ if ($nolinesbefore) {
trans('AddNewLine'); ?>trans("FreeZone"); ?>
|
- element == 'supplier_proposal') { ?>
+ element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
+ {
+ ?>
trans('SupplierProposalRefFourn'); ?> |
trans('VAT'); ?> |
@@ -270,8 +273,11 @@ else {
?>
- element == 'supplier_proposal') { ?>
- |
+ element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
+ {
+ ?>
+ "> |
|
- element == 'supplier_proposal') { ?>
- |
-
-
element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
+ {
+ ?>
+ |
+ situation_counter == 1 || !$this->situation_cycle_ref) {
print '' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . ' | ';
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 94c05fd9ffe..04452f6214a 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -137,13 +137,18 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
}
?>
- element == 'supplier_proposal') { ?>
- ref_fourn; ?> |
- element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
+ {
+ ?>
+ ref_fourn?$line->ref_fourn:$line->ref_supplier);
+ ?> |
+
tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index b701c689050..b08ec473028 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -210,13 +210,13 @@ foreach ($search_array_options as $key => $val)
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
- $mode=0;
- if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
- if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
- if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
- {
- $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
- }
+ $mode_search=0;
+ if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
+ if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
+ if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
+ {
+ $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
+ }
}
// Add where from hooks
$parameters=array();
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index 6bd44d7f385..dd0243a632b 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -818,7 +818,7 @@ class Don extends CommonObject
$sql = "SELECT count(d.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " WHERE d.fk_statut > 0";
- $sql.= " AND d.entity IN (".getEntity('don').")";
+ $sql.= " AND d.entity IN (".getEntity('donation').")";
$resql=$this->db->query($sql);
if ($resql)
@@ -851,15 +851,14 @@ class Don extends CommonObject
$result='';
$label=$langs->trans("ShowDonation").': '.$this->id;
- $link = '';
+ $linkstart = '';
$linkend='';
- $picto='generic';
+ $result .= $linkstart;
+ if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
+ if ($withpicto != 2) $result.= $this->ref;
+ $result .= $linkend;
-
- if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
- if ($withpicto && $withpicto != 2) $result.=' ';
- if ($withpicto != 2) $result.=$link.$this->id.$linkend;
return $result;
}
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 1da2274e394..cb5ab766ae9 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
$sql.= " d.amount, d.fk_statut as statut, ";
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
-$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('don').")";
+$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
if ($statut != '' && $statut != '-1')
{
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 07c8b0aff00..bbb80f52cba 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -411,31 +411,33 @@ class EcmDirectory // extends CommonObject
* @param string $option Sur quoi pointe le lien
* @param int $max Max length
* @param string $more Add more param on a link
+ * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto=0,$option='',$max=0,$more='')
+ function getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
{
global $langs;
$result='';
//$newref=str_replace('_',' ',$this->ref);
$newref=$this->ref;
- $newlabel=$langs->trans("ShowECMSection").': '.$newref;
- $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($newlabel, 1).'" class="classfortooltip">';
+ $label=$langs->trans("ShowECMSection").': '.$newref;
+ $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
- $link = 'id.'§ionexpand=true'.$linkclose;
- if ($option == 'indexexpanded') $link = 'id.'§ionexpand=true'.$linkclose;
+ $linkstart = 'id.'§ionexpand=true'.$linkclose;
+ if ($option == 'indexexpanded') $linkstart = 'id.'§ionexpand=true'.$linkclose;
$linkend='';
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
$picto='dir';
+ $result .= $linkstart;
+ if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
+ if ($withpicto != 2) $result.= ($max?dol_trunc($newref,$max,'middle'):$newref);
+ $result .= $linkend;
- if ($withpicto) $result.=($link.img_object($newlabel, $picto, 'class="classfortooltip"').$linkend);
- if ($withpicto && $withpicto != 2) $result.=' ';
- if ($withpicto != 2) $result.=$link.($max?dol_trunc($newref,$max,'middle'):$newref).$linkend;
return $result;
}
diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php
index a329adfd116..ae16ad85eaf 100644
--- a/htdocs/ecm/class/ecmfiles.class.php
+++ b/htdocs/ecm/class/ecmfiles.class.php
@@ -43,6 +43,7 @@ class EcmFiles //extends CommonObject
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'ecm_files';
+ public $picto = 'generic';
/**
*/
@@ -752,43 +753,7 @@ class EcmFiles //extends CommonObject
static function LibStatut($status,$mode=0)
{
global $langs;
-
- if ($mode == 0)
- {
- $prefix='';
- if ($status == 1) return $langs->trans('Enabled');
- if ($status == 0) return $langs->trans('Disabled');
- }
- if ($mode == 1)
- {
- if ($status == 1) return $langs->trans('Enabled');
- if ($status == 0) return $langs->trans('Disabled');
- }
- if ($mode == 2)
- {
- if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
- if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
- }
- if ($mode == 3)
- {
- if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
- if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
- }
- if ($mode == 4)
- {
- if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
- if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
- }
- if ($mode == 5)
- {
- if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
- if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
- }
- if ($mode == 6)
- {
- if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
- if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
- }
+ return '';
}
diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php
index a3ffc8a37ad..9b3384a71dc 100644
--- a/htdocs/ecm/class/htmlecm.form.class.php
+++ b/htdocs/ecm/class/htmlecm.form.class.php
@@ -45,26 +45,36 @@ class FormEcm
/**
- * Retourne la liste des categories du type choisi
+ * Return list of sections
*
- * @param int $selected Id categorie preselectionnee
- * @param string $select_name Nom formulaire HTML
+ * @param int $selected Id of preselected section
+ * @param string $select_name Name of HTML select component
+ * @param string $module Module ('ecm', 'medias', ...)
* @return string String with HTML select
*/
- function select_all_sections($selected=0,$select_name='')
+ function select_all_sections($selected=0, $select_name='', $module='ecm')
{
- global $langs;
+ global $conf, $langs;
$langs->load("ecm");
- if ($select_name=="") $select_name="catParent";
+ if ($select_name=='') $select_name="catParent";
- $cat = new EcmDirectory($this->db);
- $cate_arbo = $cat->get_full_arbo();
+ if ($module == 'ecm')
+ {
+ $cat = new EcmDirectory($this->db);
+ $cate_arbo = $cat->get_full_arbo();
+ }
+ if ($module == 'medias')
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ $path = $conf->medias->multidir_output[$conf->entity];
+ $cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$','^\.'), 'relativename', SORT_ASC);
+ }
- $output = ' |