Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop_ldap

This commit is contained in:
Regis Houssin 2017-09-16 21:41:55 +02:00
commit bdc425c203
104 changed files with 1585 additions and 1460 deletions

View File

@ -3,6 +3,7 @@
# \file build/makepack-dolibarrmodule.pl # \file build/makepack-dolibarrmodule.pl
# \brief Package builder (tgz, zip, rpm, deb, exe) # \brief Package builder (tgz, zip, rpm, deb, exe)
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> # \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
# \contributor (c)2017 Nicolas ZABOURI <info@inovea-conseil.com>
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
use Cwd; use Cwd;
@ -134,7 +135,15 @@ foreach my $PROJECT (@PROJECTLIST) {
# Get version $MAJOR, $MINOR and $BUILD # Get version $MAJOR, $MINOR and $BUILD
print "Version detected for module ".$PROJECT.": "; print "Version detected for module ".$PROJECT.": ";
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php"); $result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; } $custom=false;
if (! $result) {
$result=open(IN,"<".$SOURCE."/htdocs/custom/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
if (! $result) {
die "Error: Can't open descriptor file ".$SOURCE."/htdocs/(or /htdocs/custom/)".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n";
}else{
$custom = true;
}
}
while(<IN>) while(<IN>)
{ {
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; } if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
@ -294,6 +303,9 @@ foreach my $PROJECT (@PROJECTLIST) {
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
if($custom){
$ret=`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
}
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;

View File

@ -289,7 +289,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{ {
$ok = 0; $ok = 0;
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/ }*/
} }
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2)) if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))

View File

@ -185,7 +185,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{ {
$ok = 0; $ok = 0;
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/ }*/
} }
if (isset($_POST["country"]) && ($_POST["country"] <= 0)) if (isset($_POST["country"]) && ($_POST["country"] <= 0))

View File

@ -174,7 +174,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{ {
$ok = 0; $ok = 0;
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/ }*/
} }

View File

@ -315,7 +315,7 @@ while ($i < min($num, $limit))
// Affiche un lien vers la facture client/fournisseur // Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>'; print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>'; print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';

View File

@ -399,7 +399,7 @@ print '</table>';
print '<br /><br />'; print '<br><br>';
/* /*

View File

@ -162,7 +162,7 @@ foreach ($list as $key)
print "</table>\n"; print "</table>\n";
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>'; print '<br><br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
print '</form>'; print '</form>';
llxFooter(); llxFooter();

View File

@ -662,7 +662,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{ {
$ok = 0; $ok = 0;
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/ }*/
} }
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2)) if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))

View File

@ -286,7 +286,7 @@ class PrestaShopWebservice
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1)); * $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
* // Here in $xml, a SimpleXMLElement object you can parse * // Here in $xml, a SimpleXMLElement object you can parse
* foreach ($xml->children()->children() as $attName => $attValue) * foreach ($xml->children()->children() as $attName => $attValue)
* echo $attName.' = '.$attValue.'<br />'; * echo $attName.' = '.$attValue.'<br>';
* } * }
* catch (PrestaShopWebserviceException $ex) * catch (PrestaShopWebserviceException $ex)
* { * {

View File

@ -40,10 +40,31 @@ class Dolistore
/** /**
* Constructor * Constructor
*/
function __construct()
{
global $conf, $langs;
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = false;
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang];
}
/**
* Load data from remote Dolistore market place.
* This fills ->categories
* *
* @param array $options Options * @param array $options Options
* @return void
*/ */
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{ {
global $conf, $langs; global $conf, $langs;
@ -53,21 +74,10 @@ class Dolistore
$this->categorie = $options['categorie']; $this->categorie = $options['categorie'];
$this->search = $options['search']; $this->search = $options['search'];
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = false;
if ($this->end == 0) { if ($this->end == 0) {
$this->end = $this->per_page; $this->end = $this->per_page;
} }
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5);
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang]; // 1=fr 2=en ...
try { try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
@ -75,6 +85,7 @@ class Dolistore
// Here we set the option array for the Webservice : we want products resources // Here we set the option array for the Webservice : we want products resources
$opt = array(); $opt = array();
$opt['resource'] = 'products'; $opt['resource'] = 'products';
// make a search to limit the id returned. // make a search to limit the id returned.
if ($this->search != '') { if ($this->search != '') {
$opt2 = array(); $opt2 = array();
@ -102,7 +113,9 @@ class Dolistore
$opt['sort'] = 'id_desc'; $opt['sort'] = 'id_desc';
$opt['filter[active]'] = '[1]'; $opt['filter[active]'] = '[1]';
$opt['limit'] = "$this->start,$this->end"; $opt['limit'] = "$this->start,$this->end";
// Call // $opt['filter[id]'] contais list of product id that are result of search
// Call API to get the detail
$xml = $this->api->get($opt); $xml = $this->api->get($opt);
$this->products = $xml->products->children(); $this->products = $xml->products->children();
@ -124,7 +137,12 @@ class Dolistore
} }
} }
/**
* Return tree of Dolistore categories. $this->categories must have been loaded before.
*
* @param int $parent Id of parent category
* @return string
*/
function get_categories($parent = 0) function get_categories($parent = 0)
{ {
if (!isset($this->categories)) die('not possible'); if (!isset($this->categories)) die('not possible');

View File

@ -120,7 +120,7 @@ print '</tr>';
print '</form>'; print '</form>';
print "</table>\n"; print "</table>\n";
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>'; print '<br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -55,7 +55,7 @@ $options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'
$options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0); $options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
$options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0); $options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
$options['search'] = GETPOST('search_keyword', 'alpha'); $options['search'] = GETPOST('search_keyword', 'alpha');
$dolistore = new Dolistore($options); $dolistore = new Dolistore();
if (! $user->admin) if (! $user->admin)
@ -832,6 +832,10 @@ if ($mode == 'marketplace')
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
{ {
// $options is array with filter criterias
//var_dump($options);
$dolistore->getRemoteData($options);
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>'; print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
$previouslink = $dolistore->get_previous_link(); $previouslink = $dolistore->get_previous_link();

View File

@ -235,7 +235,7 @@ print '</td></tr>';
*/ */
print '</table>'; print '</table>';
print '<br />'; print '<br>';
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
{ {
@ -293,7 +293,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br />'; print '<br>';
} }

View File

@ -233,7 +233,7 @@ foreach ($dirmodels as $reldir)
print '</table>'; print '</table>';
print "<br />"; print "<br>";
print load_fiche_titre($langs->trans("OtherOptions"),'',''); print load_fiche_titre($langs->trans("OtherOptions"),'','');

View File

@ -433,7 +433,7 @@ if ($virtualdiffersfromphysical)
} }
print '<br />'; print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -37,6 +37,10 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not lo
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
// Force entity if a value provided int HTTP header. Otherwise, will use the entity of user of token used.
if (! empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
$res=0; $res=0;
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php'; if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
if (! $res) die("Include of main fails"); if (! $res) die("Include of main fails");

View File

@ -863,7 +863,7 @@ class ActionComm extends CommonObject
* @param string $limit Limit number of answers * @param string $limit Limit number of answers
* @return array or string Error string if KO, array with actions if OK * @return array or string Error string if KO, array with actions if OK
*/ */
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='datep', $sortorder='DESC', $limit=0) static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='a.datep', $sortorder='DESC', $limit=0)
{ {
global $conf, $langs; global $conf, $langs;
@ -880,7 +880,7 @@ class ActionComm extends CommonObject
} }
if (! empty($filter)) $sql.= $filter; if (! empty($filter)) $sql.= $filter;
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder); if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
if ($limit) $sql.=$db->plimit($limit); $sql.=$db->plimit($limit, 0);
dol_syslog(get_class()."::getActions", LOG_DEBUG); dol_syslog(get_class()."::getActions", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -371,6 +371,7 @@ if ($resql)
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>'; print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
@ -382,7 +383,6 @@ if ($resql)
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print '<td class="liste_titre"></td>'; if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print '</td>'; print '</td>';
@ -395,7 +395,8 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
@ -403,7 +404,6 @@ if ($resql)
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder); if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre(""); print_liste_field_titre("");
print "</tr>\n"; print "</tr>\n";
@ -437,13 +437,23 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action (type) // Ref
print '<td>'; print '<td>';
print $actionstatic->getNomUrl(1,-1); print $actionstatic->getNomUrl(1,-1);
print '</td>'; print '</td>';
// Action (type) // User owner
print '<td>'; print '<td class="tdoverflowmax100">';
if ($obj->fk_user_action > 0)
{
$userstatic->fetch($obj->fk_user_action);
print $userstatic->getNomUrl(-1);
}
else print '&nbsp;';
print '</td>';
// Label
print '<td class="tdoverflowmax300">';
print $actionstatic->label; print $actionstatic->label;
print '</td>'; print '</td>';
@ -482,7 +492,7 @@ if ($resql)
print '</td>'; print '</td>';
// Third party // Third party
print '<td>'; print '<td class="tdoverflowmax100">';
if ($obj->socid) if ($obj->socid)
{ {
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
@ -520,16 +530,6 @@ if ($resql)
print '</td>'; print '</td>';
} }
// User owner
print '<td align="left">';
if ($obj->fk_user_action > 0)
{
$userstatic->fetch($obj->fk_user_action);
print $userstatic->getNomUrl(-1);
}
else print '&nbsp;';
print '</td>';
// Status/Percent // Status/Percent
$datep=$db->jdate($obj->datep); $datep=$db->jdate($obj->datep);
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>'; print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>';

View File

@ -611,7 +611,7 @@ if (empty($reshook))
// prevent browser refresh from closing proposal several times // prevent browser refresh from closing proposal several times
if ($object->statut == Propal::STATUS_VALIDATED) if ($object->statut == Propal::STATUS_VALIDATED)
{ {
$result=$object->cloture($user, GETPOST('statut'), GETPOST('note')); $result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','alpha'));
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -1686,6 +1686,18 @@ if ($action == 'create')
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
} }
if ($action == 'statut')
{
//Form to close proposal (signed or not)
$formquestion = array(
array('type' => 'select','name' => 'statut','label' => $langs->trans("CloseAs"),'values' => array(2=>$object->labelstatut [2],3=>$object->labelstatut [3])),
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), '', 'setstatut', $formquestion, '', 1, 250);
}
// Confirm delete // Confirm delete
else if ($action == 'delete') { else if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
@ -2213,35 +2225,6 @@ if ($action == 'create')
dol_fiche_end(); dol_fiche_end();
if ($action == 'statut')
{
/*
* Form to close proposal (signed or not)
*/
$form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
$form_close .= '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
$form_close .= '<table class="border" width="100%">';
$form_close .= '<tr><td width="150" align="left">' . $langs->trans("CloseAs") . '</td><td align="left">';
$form_close .= '<input type="hidden" name="action" value="setstatut">';
$form_close .= '<select id="statut" name="statut" class="flat">';
$form_close .= '<option value="0">&nbsp;</option>';
$form_close .= '<option value="2">' . $object->labelstatut [2] . '</option>';
$form_close .= '<option value="3">' . $object->labelstatut [3] . '</option>';
$form_close .= '</select>';
$form_close .= '</td></tr>';
$form_close .= '<tr><td width="150" align="left">' . $langs->trans('Note') . '</td><td align="left"><textarea cols="70" rows="' . ROWS_3 . '" wrap="soft" name="note">';
$form_close .= $object->note;
$form_close .= '</textarea></td></tr>';
$form_close .= '<tr><td align="center" colspan="2">';
$form_close .= '<input type="submit" class="button" name="validate" value="' . $langs->trans('Save') . '">';
$form_close .= ' &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
$form_close .= '<a name="close">&nbsp;</a>';
$form_close .= '</td>';
$form_close .= '</tr></table></form>';
print $form_close;
}
/* /*
* Boutons Actions * Boutons Actions
*/ */
@ -2253,7 +2236,7 @@ if ($action == 'create')
// modified by hook // modified by hook
if (empty($reshook)) if (empty($reshook))
{ {
if ($action != 'statut' && $action != 'editline') if ($action != 'editline')
{ {
// Validate // Validate
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)

View File

@ -238,7 +238,7 @@ llxHeader('',$langs->trans('Proposal'),$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,"; $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; $sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
@ -418,100 +418,12 @@ if ($resql)
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails");
if (! GETPOST('cancel','alpha'))
{
$objecttmp=new Propal($db);
$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;
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
dol_fiche_head(null, '', '');
$topicmail="SendSupplierProposalRef"; $topicmail="SendSupplierProposalRef";
$modelmail="supplier_proposal_send"; $modelmail="supplier_proposal_send";
$objecttmp=new Propal($db);
$trackid='ord'.$object->id;
// Cree l'objet formulaire mail include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
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;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='ord'.$object->id;
}
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, 'ord'.$object->id);
}
$formmail->withfrom=1;
$liste=$langs->trans("AllRecipientSelected");
if (count($listofselectedthirdparties) == 1)
{
$liste=array();
$thirdpartyid=array_shift($listofselectedthirdparties);
$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->withto=$liste;
$formmail->withtofree=0;
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// 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;
print $formmail->get_form();
dol_fiche_end();
} }
if ($sall) if ($sall)
@ -813,6 +725,7 @@ if ($resql)
$companystatic->name=$obj->name; $companystatic->name=$obj->name;
$companystatic->client=$obj->client; $companystatic->client=$obj->client;
$companystatic->code_client=$obj->code_client; $companystatic->code_client=$obj->code_client;
$companystatic->email=$obj->email;
// Thirdparty // Thirdparty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))

View File

@ -42,6 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->loadLangs(array("orders",'sendings','deliveries','companies','compta','bills')); $langs->loadLangs(array("orders",'sendings','deliveries','companies','compta','bills'));
@ -118,6 +119,7 @@ $checkedtypetiers=0;
$arrayfields=array( $arrayfields=array(
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1), 'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1),
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
@ -186,6 +188,7 @@ if (empty($reshook))
$search_deliveryday=''; $search_deliveryday='';
$search_deliverymonth=''; $search_deliverymonth='';
$search_deliveryyear=''; $search_deliveryyear='';
$search_project_ref='';
$viewstatut=''; $viewstatut='';
$billed=''; $billed='';
$toselect=''; $toselect='';
@ -438,6 +441,7 @@ $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$companystatic = new Societe($db); $companystatic = new Societe($db);
$formcompany=new FormCompany($db); $formcompany=new FormCompany($db);
$projectstatic=new Project($db);
$title=$langs->trans("Orders"); $title=$langs->trans("Orders");
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
@ -445,12 +449,13 @@ llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql.= " typent.code as typent_code,"; $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; $sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql.= ' c.date_creation as date_creation, c.tms as date_update'; $sql.= ' c.date_creation as date_creation, c.tms as date_update,';
$sql.= " p.rowid as project_id, p.ref as project_ref";
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks // Add fields from hooks
@ -465,6 +470,7 @@ $sql.= ', '.MAIN_DB_PREFIX.'commande as c';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
// We'll need this table joined to the select in order to filter by sale // We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($search_user > 0) if ($search_user > 0)
@ -539,6 +545,7 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 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)
{ {
@ -626,6 +633,7 @@ if ($resql)
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat; if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc; if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
if ($search_project_ref >= 0) $param.="&search_project_ref=".$search_project_ref;
if ($show_files) $param.='&show_files=' .$show_files; if ($show_files) $param.='&show_files=' .$show_files;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($billed != '') $param.='&billed='.$billed; if ($billed != '') $param.='&billed='.$billed;
@ -661,102 +669,17 @@ if ($resql)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
// TODO Move this into an invluce
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails");
if (! GETPOST('cancel','alpha'))
{
$objecttmp=new Commande($db);
$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;
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
dol_fiche_head(null, '', '');
$topicmail="SendOrderRef"; $topicmail="SendOrderRef";
$modelmail="order_send"; $modelmail="order_send";
$objecttmp=new Commande($db);
$trackid='ord'.$object->id;
// Cree l'objet formulaire mail include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
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'){ if ($massaction == 'createbills')
$formmail->fromid = $user->id;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='ord'.$object->id;
}
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, 'ord'.$object->id);
}
$formmail->withfrom=1;
$liste=$langs->trans("AllRecipientSelected");
if (count($listofselectedthirdparties) == 1)
{
$liste=array();
$thirdpartyid=array_shift($listofselectedthirdparties);
$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->withto=$liste;
$formmail->withtofree=0;
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// 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;
print $formmail->get_form();
dol_fiche_end();
}
elseif ($massaction == 'createbills')
{ {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
@ -873,6 +796,11 @@ if ($resql)
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">'; print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
print '</td>'; print '</td>';
} }
// Project ref
if (! empty($arrayfields['p.project_ref']['checked']))
{
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
}
// Thirpdarty // Thirpdarty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -1016,6 +944,7 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['p.project_ref']['checked'])) print_liste_field_titre($arrayfields['p.project_ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
@ -1073,10 +1002,12 @@ if ($resql)
$text_warning=''; $text_warning='';
$nbprod=0; $nbprod=0;
// Ref $companystatic->id=$obj->socid;
if (! empty($arrayfields['c.ref']['checked'])) $companystatic->code_client = $obj->code_client;
{ $companystatic->name=$obj->name;
print '<td class="nowrap">'; $companystatic->client=$obj->client;
$companystatic->email=$obj->email;
$generic_commande->id=$obj->rowid; $generic_commande->id=$obj->rowid;
$generic_commande->ref=$obj->ref; $generic_commande->ref=$obj->ref;
$generic_commande->statut = $obj->fk_statut; $generic_commande->statut = $obj->fk_statut;
@ -1086,6 +1017,12 @@ if ($resql)
$generic_commande->total_ht = $obj->total_ht; $generic_commande->total_ht = $obj->total_ht;
$generic_commande->total_tva = $obj->total_tva; $generic_commande->total_tva = $obj->total_tva;
$generic_commande->total_ttc = $obj->total_ttc; $generic_commande->total_ttc = $obj->total_ttc;
// Ref
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="nowrap">';
$generic_commande->lines=array(); $generic_commande->lines=array();
$generic_commande->getLinesArray(); $generic_commande->getLinesArray();
@ -1230,10 +1167,16 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
$companystatic->id=$obj->socid; // Project
$companystatic->code_client = $obj->code_client; if (! empty($arrayfields['p.project_ref']['checked']))
$companystatic->name=$obj->name; {
$companystatic->client=$obj->client; $projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
print '<td>';
if ($obj->project_id > 0) print $projectstatic->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))

View File

@ -1122,7 +1122,7 @@ if ($action == 'create')
$disableedit=1; $disableedit=1;
$disablemove=1; $disablemove=1;
$disableremove=1; $disableremove=1;
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
} }
print "</table>\n"; print "</table>\n";
@ -1541,7 +1541,7 @@ else
{ {
//$disableedit=1; //$disableedit=1;
//$disablemove=1; //$disablemove=1;
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice $ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
} }
// Form to add new line // Form to add new line
@ -1552,7 +1552,7 @@ else
$var = true; $var = true;
// Add free products/services // Add free products/services
$object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -345,6 +345,7 @@ $formfile = new FormFile($db);
$bankaccountstatic=new Account($db); $bankaccountstatic=new Account($db);
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$formcompany=new FormCompany($db); $formcompany=new FormCompany($db);
$thirdpartystatic=new Societe($db);
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
@ -355,7 +356,7 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' f.datec as date_creation, f.tms as date_update,'; $sql.= ' f.datec as date_creation, f.tms as date_update,';
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,"; $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name"; $sql.= " state.code_departement as state_code, state.nom as state_name";
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
@ -493,7 +494,7 @@ if (! $sall)
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
$sql.= ' f.datec, f.tms,'; $sql.= ' f.datec, f.tms,';
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,'; $sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,';
$sql.= ' state.code_departement, state.nom'; $sql.= ' state.code_departement, state.nom';
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
@ -610,101 +611,12 @@ if ($resql)
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails");
if (! GETPOST('cancel','alpha'))
{
$objecttmp=new Facture($db);
$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;
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
dol_fiche_head(null, '', '');
$topicmail="SendBillRef"; $topicmail="SendBillRef";
$modelmail="facture_send"; $modelmail="facture_send";
$objecttmp=new Facture($db);
$trackid='inv'.$object->id;
// Cree l'objet formulaire mail include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
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;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='inv'.$object->id;
}
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, 'inv'.$object->id);
}
$formmail->withfrom=1;
$liste=$langs->trans("AllRecipientSelected");
if (count($listofselectedthirdparties) == 1)
{
$liste=array();
$thirdpartyid=array_shift($listofselectedthirdparties);
$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->withto=$liste;
$formmail->withtofree=0;
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des parametres complementaires du post
$formmail->param['action']=$action;
$formmail->param['models']=$modelmail;
$formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['facid']=join(',',$arrayofselected);
// TODO We should use $formmail->param['id']=join(',',$arrayofselected);
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form();
dol_fiche_end();
} }
if ($sall) if ($sall)
@ -1099,12 +1011,12 @@ if ($resql)
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax200">';
$thirdparty=new Societe($db); $thirdpartystatic->id=$obj->socid;
$thirdparty->id=$obj->socid; $thirdpartystatic->name=$obj->name;
$thirdparty->name=$obj->name; $thirdpartystatic->client=$obj->client;
$thirdparty->client=$obj->client; $thirdpartystatic->code_client=$obj->code_client;
$thirdparty->code_client=$obj->code_client; $thirdpartystatic->email=$obj->email;
print $thirdparty->getNomUrl(1,'customer'); print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -506,12 +506,12 @@ class Paiement extends CommonObject
/** /**
* Add a record into bank for payment with links between this bank record and invoices of payment. * Add a record into bank for payment + links between this bank record and sources of payment.
* All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create(). * All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
* *
* @param User $user Object of user making payment * @param User $user Object of user making payment
* @param string $mode 'payment', 'payment_supplier' * @param string $mode 'payment', 'payment_supplier'
* @param string $label Label to use in bank record * @param string $label Label to use in bank record. Note: If label is '(WithdrawalPayment)', a third entry 'widthdraw' is added into bank_url.
* @param int $accountid Id of bank account to do link with * @param int $accountid Id of bank account to do link with
* @param string $emetteur_nom Name of transmitter * @param string $emetteur_nom Name of transmitter
* @param string $emetteur_banque Name of bank * @param string $emetteur_banque Name of bank
@ -595,10 +595,11 @@ class Paiement extends CommonObject
} }
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if (! $error && $label != '(WithdrawalPayment)') //if (! $error && $label != '(WithdrawalPayment)')
if (! $error)
{ {
$linkaddedforthirdparty=array(); $linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of. foreach ($this->amounts as $key => $value) // We should have invoices always for same third party but we loop in case of.
{ {
if ($mode == 'payment') if ($mode == 'payment')
{ {

View File

@ -51,6 +51,9 @@ if (! $sortfield) $sortfield="p.datec";
// Get supervariables // Get supervariables
$statut = GETPOST('statut','int'); $statut = GETPOST('statut','int');
$search_ref = GETPOST('search_ref','alpha'); $search_ref = GETPOST('search_ref','alpha');
$search_amount = GETPOST('search_amount','alpha');
$bon=new BonPrelevement($db,"");
/* /*
@ -60,6 +63,7 @@ $search_ref = GETPOST('search_ref','alpha');
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{ {
$search_ref=""; $search_ref="";
$search_amount="";
} }
@ -69,13 +73,12 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
llxHeader('',$langs->trans("WithdrawalsReceipts")); llxHeader('',$langs->trans("WithdrawalsReceipts"));
$bon=new BonPrelevement($db,"");
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut"; $sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
$sql.= ", p.datec"; $sql.= ", p.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
if ($search_ref) $sql.=natural_search("p.ref", $search_ref); if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
if ($search_amount) $sql.=natural_search("p.amount", $search_amount, 1);
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
@ -97,6 +100,8 @@ if ($result)
$urladd= "&amp;statut=".$statut; $urladd= "&amp;statut=".$statut;
$selectedfields='';
// Lines of title fields // Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -116,7 +121,9 @@ if ($result)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
@ -125,9 +132,11 @@ if ($result)
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"'); print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"","","",'align="center"'); print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"p.amount","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print "</tr>\n"; print "</tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
@ -136,15 +145,18 @@ if ($result)
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $bon->LibStatut($obj->statut,2);
print "&nbsp;";
print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n"; print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td align="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td align="right"></td>'."\n";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -20,7 +20,7 @@
/** /**
* \file htdocs/compta/prelevement/card.php * \file htdocs/compta/prelevement/card.php
* \ingroup prelevement * \ingroup prelevement
* \brief Fiche prelevement * \brief Card of a direct debit
*/ */
require('../../main.inc.php'); require('../../main.inc.php');
@ -45,20 +45,24 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables // Get supervariables
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit','int')?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 (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) $sortfield='pl.fk_soc'; if (! $sortfield) $sortfield='pl.fk_soc';
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
$object = new BonPrelevement($db,"");
/* /*
* Actions * Actions
@ -66,10 +70,9 @@ if (! $sortorder) $sortorder='DESC';
if ( $action == 'confirm_delete' ) if ( $action == 'confirm_delete' )
{ {
$bon = new BonPrelevement($db,""); $object->fetch($id, $ref);
$bon->fetch($id);
$res=$bon->delete(); $res=$object->delete();
if ($res > 0) if ($res > 0)
{ {
header("Location: index.php"); header("Location: index.php");
@ -77,12 +80,12 @@ if ( $action == 'confirm_delete' )
} }
} }
// Seems to no be used and replaced with $action == 'infocredit
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes') if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
{ {
$bon = new BonPrelevement($db,""); $object->fetch($id, $ref);
$bon->fetch($id);
$res=$bon->set_credite(); $res=$object->set_credite();
if ($res >= 0) if ($res >= 0)
{ {
header("Location: card.php?id=".$id); header("Location: card.php?id=".$id);
@ -94,19 +97,18 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$bon = new BonPrelevement($db,""); $object->fetch($id, $ref);
$bon->fetch($id);
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
/* /*
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref) if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
{ {
$dir = $conf->prelevement->dir_output.'/receipts'; $dir = $conf->prelevement->dir_output.'/receipts';
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0) if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
{ {
$bon->set_infotrans($user, $dt, GETPOST('methode','alpha')); $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
} }
header("Location: card.php?id=".$id); header("Location: card.php?id=".$id);
@ -118,7 +120,7 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
$mesg='BadFile'; $mesg='BadFile';
}*/ }*/
$error = $bon->set_infotrans($user, $dt, GETPOST('methode','alpha')); $error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
if ($error) if ($error)
{ {
@ -127,13 +129,13 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
} }
} }
// Set direct debit order to credited, create payment and close invoices
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
{ {
$bon = new BonPrelevement($db,""); $object->fetch($id, $ref);
$bon->fetch($id);
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$error = $bon->set_infocredit($user, $dt); $error = $object->set_infocredit($user, $dt);
if ($error) if ($error)
{ {
@ -143,61 +145,66 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
} }
/* /*
* View * View
*/ */
$bon = new BonPrelevement($db,"");
$form = new Form($db); $form = new Form($db);
llxHeader('',$langs->trans("WithdrawalsReceipts")); llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($id > 0 || $ref)
if ($id > 0)
{ {
$bon->fetch($id); $object->fetch($id, $ref);
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($object);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), '', 'payment'); dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
if (GETPOST('error','alpha')!='') if (GETPOST('error','alpha')!='')
{ {
print '<div class="error">'.$bon->getErrorString(GETPOST('error','alpha')).'</div>'; print '<div class="error">'.$object->getErrorString(GETPOST('error','alpha')).'</div>';
} }
/*if ($action == 'credite') /*if ($action == 'credite')
{ {
print $form->formconfirm("card.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
}*/ }*/
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>'; //print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
// Status // Status
/*
print '<tr><td>'.$langs->trans('Status').'</td>'; print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>'; print '<td>'.$object->getLibStatut(1).'</td>';
print '</tr>'; print '</tr>';
*/
if($bon->date_trans <> 0) if($object->date_trans <> 0)
{ {
$muser = new User($db); $muser = new User($db);
$muser->fetch($bon->user_trans); $muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>'; print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day'); print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>'; print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>'; print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans]; print $object->methodes_trans[$object->method_trans];
print '</td></tr>'; print '</td></tr>';
} }
if($bon->date_credit <> 0) if($object->date_credit <> 0)
{ {
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>'; print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day'); print dol_print_date($object->date_credit,'day');
print '</td></tr>'; print '</td></tr>';
} }
@ -205,19 +212,36 @@ if ($id > 0)
print '<br>'; print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>'; print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml'; $relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted') if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
{ {
print '<form method="post" name="userfile" action="card.php?id='.$bon->id.'" enctype="multipart/form-data">'; print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infotrans">'; print '<input type="hidden" name="action" value="infotrans">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -227,7 +251,7 @@ if ($id > 0)
print $form->select_date('','','','','',"userfile",1,1); print $form->select_date('','','','','',"userfile",1,1);
print '</td></tr>'; print '</td></tr>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>'; print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode",$bon->methodes_trans); print $form->selectarray("methode",$object->methodes_trans);
print '</td></tr>'; print '</td></tr>';
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>'; /* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">'; print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
@ -238,9 +262,9 @@ if ($id > 0)
print '</form>'; print '</form>';
} }
if (! empty($bon->date_trans) && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited') if (! empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
{ {
print '<form name="infocredit" method="post" action="card.php?id='.$bon->id.'">'; print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infocredit">'; print '<input type="hidden" name="action" value="infocredit">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -261,17 +285,17 @@ if ($id > 0)
{ {
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send) if (empty($object->date_trans) && $user->rights->prelevement->bons->send)
{ {
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$bon->id."\">".$langs->trans("SetToStatusSent")."</a>"; print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$object->id."\">".$langs->trans("SetToStatusSent")."</a>";
} }
if (! empty($bon->date_trans) && $bon->date_credit == 0) if (! empty($object->date_trans) && $object->date_credit == 0)
{ {
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$bon->id."\">".$langs->trans("ClassCredited")."</a>"; print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$object->id."\">".$langs->trans("ClassCredited")."</a>";
} }
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$bon->id."\">".$langs->trans("Delete")."</a>"; print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
print "</div>"; print "</div>";
} }
@ -293,7 +317,16 @@ if ($id > 0)
$sql.= " AND pl.fk_soc = s.rowid"; $sql.= " AND pl.fk_soc = s.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql); $result = $db->query($sql);
@ -304,8 +337,9 @@ if ($id > 0)
$urladd = "&amp;id=".$id; $urladd = "&amp;id=".$id;
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd); print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
@ -363,12 +397,17 @@ if ($id > 0)
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>'; print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td align="right">'.price($total)."</td>\n"; print '<td align="right">';
if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
print price($total);
print "</td>\n";
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
print "</table>"; print "</table>";
print '</div>';
$db->free($result); $db->free($result);
} }
else else

View File

@ -38,6 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
*/ */
class BonPrelevement extends CommonObject class BonPrelevement extends CommonObject
{ {
public $element='widthdraw';
public $table_element='prelevement_bons';
public $picto = 'payment';
var $date_echeance; var $date_echeance;
var $raison_sociale; var $raison_sociale;
var $reference_remise; var $reference_remise;
@ -263,10 +267,11 @@ class BonPrelevement extends CommonObject
/** /**
* Get object and lines from database * Get object and lines from database
* *
* @param int $rowid id of object to load * @param int $rowid Id of object to load
* @param string $ref Ref of direct debit
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function fetch($rowid) function fetch($rowid, $ref='')
{ {
global $conf; global $conf;
@ -278,8 +283,9 @@ class BonPrelevement extends CommonObject
$sql.= ", p.fk_user_credit"; $sql.= ", p.fk_user_credit";
$sql.= ", p.statut"; $sql.= ", p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE p.rowid = ".$rowid; $sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND p.entity = ".$conf->entity; if ($rowid > 0) $sql.= " AND p.rowid = ".$rowid;
else $sql.= " AND p.ref = '".$this->db->escape($ref)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result=$this->db->query($sql); $result=$this->db->query($sql);
@ -321,7 +327,7 @@ class BonPrelevement extends CommonObject
} }
/** /**
* Set credite and set status of linked invoices * Set credite and set status of linked invoices. Still used ??
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
@ -345,7 +351,7 @@ class BonPrelevement extends CommonObject
$error++; $error++;
} }
if ($error == 0) if (! $error)
{ {
$facs = array(); $facs = array();
$facs = $this->getListInvoices(); $facs = $this->getListInvoices();
@ -361,9 +367,8 @@ class BonPrelevement extends CommonObject
} }
} }
if ($error == 0) if (! $error)
{ {
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes"; $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
$sql.= " SET statut = 2"; $sql.= " SET statut = 2";
$sql.= " WHERE fk_prelevement_bons = ".$this->id; $sql.= " WHERE fk_prelevement_bons = ".$this->id;
@ -378,7 +383,7 @@ class BonPrelevement extends CommonObject
/* /*
* End of procedure * End of procedure
*/ */
if ($error == 0) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
return 0; return 0;
@ -399,9 +404,9 @@ class BonPrelevement extends CommonObject
} }
/** /**
* Set withdrawal to credited status * Set direct debit order to "credited" status.
* *
* @param User $user id of user * @param User $user Id of user
* @param int $date date of action * @param int $date date of action
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
@ -436,37 +441,43 @@ class BonPrelevement extends CommonObject
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
$facs = array(); $facs = array();
$amounts = array(); $amounts = array();
$amountsperthirdparty = array();
$facs = $this->getListInvoices(1); $facs = $this->getListInvoices(1);
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
$num=count($facs); $num=count($facs);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
$fac = new Facture($this->db); $fac = new Facture($this->db);
$fac->fetch($facs[$i][0]); $fac->fetch($facs[$i][0]);
$amounts[$fac->id] = $facs[$i][1]; $amounts[$fac->id] = $facs[$i][1];
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
$totalpaye = $fac->getSommePaiement(); $totalpaye = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed(); $totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed(); $totaldeposits = $fac->getSumDepositsUsed();
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits; $alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
if ($alreadypayed + $facs[$i][1] >= $fac->total_ttc) { if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
$result = $fac->set_paid($user); $result = $fac->set_paid($user);
} }
} }
// Make one payment per customer
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
{
$paiement = new Paiement($this->db); $paiement = new Paiement($this->db);
$paiement->datepaye = $date; $paiement->datepaye = $date;
$paiement->amounts = $amounts; $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
$paiement->paiementid = 3; // $paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref ; $paiement->num_paiement = $this->ref; // Set ref of direct debit note
$paiement->id_prelevement = $this->id; $paiement->id_prelevement = $this->id;
$paiement_id = $paiement->create($user); $paiement_id = $paiement->create($user);
if ($paiement_id < 0) if ($paiement_id < 0)
{ {
dol_syslog(get_class($this)."::set_credite AddPayment Error"); dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
$error++; $error++;
} }
else else
@ -474,10 +485,15 @@ class BonPrelevement extends CommonObject
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'',''); $result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'','');
if ($result < 0) if ($result < 0)
{ {
dol_syslog(get_class($this)."::set_credite AddPaymentToBank Error"); dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
$error++; $error++;
} }
} }
//var_dump($paiement->amounts);
//var_dump($thirdpartyid);
//var_dump($cursoramounts);
}
// Update withdrawal line // Update withdrawal line
// TODO: Translate to ligneprelevement.class.php // TODO: Translate to ligneprelevement.class.php
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes"; $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
@ -486,7 +502,7 @@ class BonPrelevement extends CommonObject
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
dol_syslog(get_class($this)."::set_credite Update lines Error"); dol_syslog(get_class($this)."::set_infocredit Update lines Error");
$error++; $error++;
} }
@ -951,14 +967,14 @@ class BonPrelevement extends CommonObject
} }
} }
/*
* Create withdrawal receipt
*/
if (!$error) if (!$error)
{ {
/*
* Create withdrawal receipt in database
*/
if (count($factures_prev) > 0) if (count($factures_prev) > 0)
{ {
foreach ($factures_prev as $fac) foreach ($factures_prev as $fac) // Add a link in database for each invoice
{ {
// Fetch invoice // Fetch invoice
$fact = new Facture($this->db); $fact = new Facture($this->db);
@ -998,7 +1014,6 @@ class BonPrelevement extends CommonObject
} }
} }
} }
} }
@ -1006,11 +1021,12 @@ class BonPrelevement extends CommonObject
if (!$error) if (!$error)
{ {
/* /*
* Withdraw receipt * Create direct debit order in a XML file
*/ */
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG); dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
if (count($factures_prev) > 0) if (count($factures_prev) > 0)
{ {
$this->date_echeance = $datetimeprev; $this->date_echeance = $datetimeprev;
@ -1034,11 +1050,12 @@ class BonPrelevement extends CommonObject
$this->factures = $factures_prev_id; $this->factures = $factures_prev_id;
// Generation of SEPA file // Generation of SEPA file $this->filename
$this->generate(); $this->generate();
} }
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
} }
//var_dump($factures_prev);exit;
/* /*
* Update total * Update total
@ -1289,8 +1306,9 @@ class BonPrelevement extends CommonObject
$sql.= " AND soc.rowid = f.fk_soc"; $sql.= " AND soc.rowid = f.fk_soc";
$sql.= " AND rib.fk_soc = f.fk_soc"; $sql.= " AND rib.fk_soc = f.fk_soc";
$sql.= " AND rib.default_rib = 1"; $sql.= " AND rib.default_rib = 1";
//print $sql;
//echo $sql; // Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -1302,27 +1320,26 @@ class BonPrelevement extends CommonObject
$this->total = $this->total + $obj->somme; $this->total = $this->total + $obj->somme;
$i++; $i++;
} }
$nbtotalDrctDbtTxInf = $i;
} }
else else
{ {
fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf); fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
$result = -2; $result = -2;
} }
/* // Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf
* section Emetteur(sepa Emetteur bloc lines)
*/
if ($result != -2) if ($result != -2)
{ {
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf); $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf);
} }
else else
{ {
fputs($this->file, 'ERREUR EMETTEUR'.$CrLf); fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company
} }
/** /**
* SECTION CREATION FICHIER SEPA * SECTION CREATION SEPA FILE
*/ */
// SEPA File Header // SEPA File Header
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
@ -1822,7 +1839,7 @@ class BonPrelevement extends CommonObject
* Return status label for a status * Return status label for a status
* *
* @param int $statut id statut * @param int $statut id statut
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut,$mode=0) function LibStatut($statut,$mode=0)
@ -1846,8 +1863,25 @@ class BonPrelevement extends CommonObject
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3'); if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6'); if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
} }
if ($mode == 3) if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 6)
{ {
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1'); if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3'); if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');

View File

@ -67,7 +67,7 @@ if ($action == 'create')
{ {
setEventMessages($bprev->error, $bprev->errors, 'errors'); setEventMessages($bprev->error, $bprev->errors, 'errors');
} }
if ($result == 0) elseif ($result == 0)
{ {
$mesg=''; $mesg='';
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed"); $mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
@ -78,6 +78,10 @@ if ($action == 'create')
$mesg.=$val."<br>\n"; $mesg.=$val."<br>\n";
} }
} }
else
{
setEventMessages($langs->trans("DirectDebitOrderCreated"), null);
}
} }

View File

@ -43,6 +43,7 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables // Get supervariables
$prev_id = GETPOST('id','int'); $prev_id = GETPOST('id','int');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
$ref = GETPOST('ref', 'alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -55,6 +56,9 @@ $pagenext = $page + 1;
if (! $sortfield) $sortfield='p.ref'; if (! $sortfield) $sortfield='p.ref';
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
$object = new BonPrelevement($db,"");
/* /*
* View * View
@ -65,39 +69,41 @@ $thirdpartytmp = new Societe($db);
llxHeader('',$langs->trans("WithdrawalsReceipts")); llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id) if ($prev_id > 0 || $ref)
{ {
$bon = new BonPrelevement($db,""); if ($object->fetch($prev_id, $ref) == 0)
if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($object);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), '', 'payment'); dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>'; //print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
// Status // Status
print '<tr><td>'.$langs->trans('Status').'</td><td>'.$bon->getLibStatut(1).'</td></tr>'; //print '<tr><td>'.$langs->trans('Status').'</td><td>'.$object->getLibStatut(1).'</td></tr>';
if($bon->date_trans <> 0) if($object->date_trans <> 0)
{ {
$muser = new User($db); $muser = new User($db);
$muser->fetch($bon->user_trans); $muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>'; print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day'); print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>'; print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>'; print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans]; print $object->methodes_trans[$object->method_trans];
print '</td></tr>'; print '</td></tr>';
} }
if($bon->date_credit <> 0) if($object->date_credit <> 0)
{ {
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>'; print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day'); print dol_print_date($object->date_credit,'day');
print '</td></tr>'; print '</td></tr>';
} }
@ -105,12 +111,29 @@ if ($prev_id)
print '<br>'; print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>'; print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml'; $relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();
} }
@ -137,7 +160,6 @@ $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($prev_id) $sql.= " AND p.rowid=".$prev_id; if ($prev_id) $sql.= " AND p.rowid=".$prev_id;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
// Count total nb of records // Count total nb of records
@ -172,9 +194,10 @@ if ($result)
$massactionbutton=''; $massactionbutton='';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); print_barre_liste($langs->trans("Invoices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder); print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
@ -243,13 +266,18 @@ if ($result)
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>'; print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td align="right">'.price($total)."</td>\n"; print '<td align="right">';
if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
print price($total);
print "</td>\n";
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
print "</table>"; print "</table>";
print '</div>';
$db->free($result); $db->free($result);
} }
else else

View File

@ -41,49 +41,69 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables // Get supervariables
$prev_id = GETPOST('id','int'); $prev_id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$object = new BonPrelevement($db,"");
/* /*
* View * View
*/ */
llxHeader('',$langs->trans("WithdrawalsReceipts")); llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id) if ($prev_id > 0 || $ref)
{ {
$bon = new BonPrelevement($db,""); if ($object->fetch($prev_id, $ref) == 0)
if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($object);
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), '', 'payment'); dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
print '<table class="border" width="100%">'; dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>'; print '<div class="fichecenter">';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<div class="underbanner clearboth"></div>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<table class="border centpercent">'."\n";
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
// Status // Status
/*
print '<tr><td>'.$langs->trans('Status').'</td>'; print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>'; print '<td>'.$object->getLibStatut(1).'</td>';
print '</tr>'; print '</tr>';
*/
if($bon->date_trans <> 0) if($object->date_trans <> 0)
{ {
$muser = new User($db); $muser = new User($db);
$muser->fetch($bon->user_trans); $muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>'; print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day'); print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>'; print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>'; print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans]; print $object->methodes_trans[$object->method_trans];
print '</td></tr>'; print '</td></tr>';
} }
if($bon->date_credit <> 0) if($object->date_credit <> 0)
{ {
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>'; print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day'); print dol_print_date($object->date_credit,'day');
print '</td></tr>'; print '</td></tr>';
} }
@ -91,12 +111,29 @@ if ($prev_id)
print '<br>'; print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>'; print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml'; $relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();
} }
@ -109,7 +146,7 @@ if ($prev_id)
$rej = new RejetPrelevement($db, $user); $rej = new RejetPrelevement($db, $user);
/* /*
* Liste des factures * List errors
*/ */
$sql = "SELECT pl.rowid, pl.amount, pl.statut"; $sql = "SELECT pl.rowid, pl.amount, pl.statut";
$sql.= " , s.rowid as socid, s.nom as name"; $sql.= " , s.rowid as socid, s.nom as name";
@ -127,12 +164,25 @@ $sql.= " AND pr.fk_prelevement_lignes = pl.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY pl.amount DESC"; $sql.= " ORDER BY pl.amount DESC";
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print_barre_liste($langs->trans("Rejects"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>'; print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>';
@ -181,6 +231,8 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
} }
print "</table>\n"; print "</table>\n";
print '</div>';
$db->free($resql); $db->free($resql);
} }
else else

View File

@ -38,7 +38,21 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables // Get supervariables
$prev_id = GETPOST('id','int'); $prev_id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$object = new BonPrelevement($db,"");
/* /*
* View * View
@ -48,40 +62,44 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id) if ($prev_id)
{ {
$bon = new BonPrelevement($db,""); if ($object->fetch($prev_id) == 0)
if ($bon->fetch($prev_id) == 0)
{ {
$head = prelevement_prepare_head($bon); $head = prelevement_prepare_head($object);
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment'); dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
print '<table class="border" width="100%">'; dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>'; print '<div class="fichecenter">';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<div class="underbanner clearboth"></div>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<table class="border centpercent">'."\n";
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
// Status // Status
/*
print '<tr><td>'.$langs->trans('Status').'</td>'; print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>'; print '<td>'.$object->getLibStatut(1).'</td>';
print '</tr>'; print '</tr>';
*/
if($bon->date_trans <> 0) if($object->date_trans <> 0)
{ {
$muser = new User($db); $muser = new User($db);
$muser->fetch($bon->user_trans); $muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>'; print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day'); print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>'; print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>'; print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans]; print $object->methodes_trans[$object->method_trans];
print '</td></tr>'; print '</td></tr>';
} }
if($bon->date_credit <> 0) if($object->date_credit <> 0)
{ {
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>'; print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day'); print dol_print_date($object->date_credit,'day');
print '</td></tr>'; print '</td></tr>';
} }
@ -89,12 +107,29 @@ if ($prev_id)
print '<br>'; print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>'; print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml'; $relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();
} }
@ -139,7 +174,7 @@ if ($prev_id)
print price($row[0]); print price($row[0]);
print '</td><td align="right">'; print '</td><td align="right">';
if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %"; if ($object->amount) print round($row[0]/$object->amount*100,2)." %";
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -965,6 +965,7 @@ if (empty($reshook))
$trackid='cont'.$object->id; $trackid='cont'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
{ {
if ($action == 'addcontact') if ($action == 'addcontact')
@ -2052,6 +2053,16 @@ else
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
// Send
if ($object->statut == 1) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>';
} else
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendByMail') . '</a></div>';
}
if ($object->statut == 0 && $nbofservices) if ($object->statut == 0 && $nbofservices)
{ {
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a></div>'; if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a></div>';
@ -2109,6 +2120,7 @@ else
{ {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>';
} }
}
print "</div>"; print "</div>";
} }
@ -2193,7 +2205,7 @@ else
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans('SendContractByMail')); print load_fiche_titre($langs->trans('SendByMail'));
dol_fiche_head(''); dol_fiche_head('');
@ -2207,7 +2219,7 @@ else
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
} }
$formmail->trackid='ord'.$object->id; $formmail->trackid='cont'.$object->id;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set 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'; include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -2229,9 +2241,19 @@ else
$formmail->withbody = 1; $formmail->withbody = 1;
$formmail->withdeliveryreceipt = 1; $formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1; $formmail->withcancel = 1;
// Tableau des substitutions // Array of substitutions
$formmail->withsubstit='AvailableVariables';
$formmail->setSubstitFromObject($object); $formmail->setSubstitFromObject($object);
$formmail->substit ['__CONTRACTREF__'] = $object->ref; $datenextexpiration='';
foreach($object->lines as $line)
{
if ($line->statut != 4) continue;
if ($line->date_fin_prevue > $datenextexpiration) $datenextexpiration = $line->date_fin_prevue;
}
$formmail->substit['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
$formmail->substit['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
$custcontact = ''; $custcontact = '';
$contactarr = array(); $contactarr = array();

View File

@ -29,8 +29,9 @@
*/ */
require ("../main.inc.php"); require ("../main.inc.php");
require_once (DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"); require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -81,6 +82,8 @@ $id=GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat', $id); $result = restrictedArea($user, 'contrat', $id);
$diroutputmassaction=$conf->contrat->dir_output . '/temp/massgeneration/'.$user->id;
$staticcontrat=new Contrat($db); $staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db); $staticcontratligne=new ContratLigne($db);
@ -185,6 +188,7 @@ if (empty($reshook))
$now=dol_now(); $now=dol_now();
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$socstatic = new Societe($db); $socstatic = new Societe($db);
$contracttmp = new Contrat($db); $contracttmp = new Contrat($db);
@ -334,8 +338,8 @@ if ($resql)
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
@ -352,6 +356,16 @@ if ($resql)
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit); print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
if ($massaction == 'presend')
{
$topicmail="SendContractRef";
$modelmail="contract";
$objecttmp=new Contrat($db);
$trackid='con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
}
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
@ -586,6 +600,13 @@ if ($resql)
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>'; print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>'; print '</span>';
} }
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->contrat->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['c.ref_customer']['checked'])) if (! empty($arrayfields['c.ref_customer']['checked']))
@ -750,6 +771,25 @@ if ($resql)
print '</div>'; print '</div>';
print '</form>'; print '</form>';
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->contrat->lire;
$delallowed=$user->rights->contrat->lire;
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
} }
else else
{ {

View File

@ -52,7 +52,7 @@ if (! $error && count($toselect) > $maxformassaction)
$error++; $error++;
} }
if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form if (! $error && $massaction == 'confirm_presend' && ! GETPOST('sendmail')) // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form
{ {
$massaction='presend'; $massaction='presend';
} }
@ -85,6 +85,7 @@ if (! $error && $massaction == 'confirm_presend')
{ {
$listofobjectid[$toselectid]=$toselectid; $listofobjectid[$toselectid]=$toselectid;
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id;
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
} }
@ -172,15 +173,16 @@ if (! $error && $massaction == 'confirm_presend')
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
$listofqualifiedid=array(); $listofqualifiedid=array();
$listofqualifiedref=array(); $listofqualifiedref=array();
$thirdpartywithoutemail=array();
foreach($listofobjectref[$thirdpartyid] as $objectid => $object) foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
{ {
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut); //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
if ($objectclass == 'Propal' && $object->statut == Propal::STATUS_DRAFT)
if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED)
{ {
$langs->load("errors"); $langs->load("errors");
$nbignored++; $nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$object->ref).'</div><br>';
continue; // Payment done or started or canceled continue; // Payment done or started or canceled
} }
if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT) if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT)
@ -190,17 +192,15 @@ if (! $error && $massaction == 'confirm_presend')
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'</div><br>';
continue; continue;
} }
if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED)
// Read document
// TODO Use future field $object->fullpathdoc to know where is stored default file
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
$filename=dol_sanitizeFileName($object->ref).'.pdf';
$filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref);
$file = $filedir . '/' . $filename;
$mime = dol_mimetype($file);
if (dol_is_file($file))
{ {
$langs->load("errors");
$nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
continue; // Payment done or started or canceled
}
// Test recipient
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -211,10 +211,25 @@ if (! $error && $massaction == 'confirm_presend')
{ {
//print "No recipient for thirdparty ".$object->thirdparty->name; //print "No recipient for thirdparty ".$object->thirdparty->name;
$nbignored++; $nbignored++;
if (empty($thirdpartywithoutemail[$object->thirdparty->id]))
{
$resaction.='<div class="error">'.$langs->trans('NoRecipientEmail',$object->thirdparty->name).'</div><br>';
}
dol_syslog('No recipient for thirdparty: '.$object->thirdparty->name, LOG_WARNING);
$thirdpartywithoutemail[$object->thirdparty->id]=1;
continue; continue;
} }
if (dol_strlen($sendto)) if ($_POST['addmaindocfile'])
{
// TODO Use future field $object->fullpathdoc to know where is stored default file
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
$filename=dol_sanitizeFileName($object->ref).'.pdf';
$filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref);
$file = $filedir . '/' . $filename;
$mime = dol_mimetype($file);
if (dol_is_file($file))
{ {
// Create form object // Create form object
$attachedfiles=array( $attachedfiles=array(
@ -223,10 +238,6 @@ if (! $error && $massaction == 'confirm_presend')
'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) 'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
); );
} }
$listofqualifiedid[$objectid]=$object;
$listofqualifiedref[$objectid]=$object->ref;
}
else else
{ {
$nbignored++; $nbignored++;
@ -235,11 +246,17 @@ if (! $error && $massaction == 'confirm_presend')
dol_syslog('Failed to read file: '.$file, LOG_WARNING); dol_syslog('Failed to read file: '.$file, LOG_WARNING);
continue; continue;
} }
}
// Object of thirdparty qualified
$listofqualifiedid[$objectid]=$object;
$listofqualifiedref[$objectid]=$object->ref;
//var_dump($listofqualifiedref); //var_dump($listofqualifiedref);
} }
// Loop on each qualified objects of the thirdparty // Send email if there is at least one qualified record
if (count($listofqualifiedid) > 0) if (count($listofqualifiedid) > 0)
{ {
$langs->load("commercial"); $langs->load("commercial");
@ -264,8 +281,8 @@ if (! $error && $massaction == 'confirm_presend')
} }
$replyto = $from; $replyto = $from;
$subject = GETPOST('subject'); $subject = GETPOST('subject','none');
$message = GETPOST('message'); $message = GETPOST('message','none');
$sendtocc = GETPOST('sentocc'); $sendtocc = GETPOST('sentocc');
$sendtobcc = ''; $sendtobcc = '';
if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
@ -275,28 +292,18 @@ if (! $error && $massaction == 'confirm_presend')
if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO); if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO);
if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO); if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO);
$objecttmp=new $objectclass($db);
$objecttmp->thirdparty = $thirdparty;
$substitutionarray=array( // Make substitution in email content
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp);
'__ID__' => join(', ',array_keys($listofqualifiedid)), $substitutionarray['__ID__'] = join(', ',array_keys($listofqualifiedid));
'__EMAIL__' => $thirdparty->email, $substitutionarray['__EMAIL__'] = $thirdparty->email;
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>', $substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility $substitutionarray['__REF__'] = join(', ',$listofqualifiedref);
'__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility
'__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility $parameters=array('mode'=>'formemail');
'__REF__' => join(', ',$listofqualifiedref), complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters);
'__REFCLIENT__' => $thirdparty->name,
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
/* not available on all object
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''),
'__ADDRESS__'=>(is_object($object)?$object->address:''),
'__ZIP__'=>(is_object($object)?$object->zip:''),
'__TOWN_'=>(is_object($object)?$object->town:''),
'__COUNTRY__'=>(is_object($object)?$object->country:''),
*/
);
$subject=make_substitutions($subject, $substitutionarray); $subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray); $message=make_substitutions($message, $substitutionarray);
@ -408,6 +415,12 @@ if (! $error && $massaction == 'confirm_presend')
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search')) if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
{ {
if (empty($diroutputmassaction))
{
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
exit;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -502,7 +515,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
} }
else { else {
// Create empty PDF // Create empty PDF
$pdf=pdf_getInstance(); $formatarray=pdf_getFormat();
$page_largeur = $formatarray['width'];
$page_hauteur = $formatarray['height'];
$format = array($page_largeur,$page_hauteur);
$pdf=pdf_getInstance($format);
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);

View File

@ -258,7 +258,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$message = $_POST['message']; $message = GETPOST('message','none');
$subject = GETPOST('subject','none');
// Make a change into HTML code to allow to include images from medias directory with an external reabable URL. // Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" /> // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
@ -278,7 +279,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($action == 'send' || $action == 'relance') if ($action == 'send' || $action == 'relance')
{ {
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1); $actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
if ($message) if ($message)
{ {
@ -344,23 +344,25 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
} }
$substitutionarray=array( // Make substitution in email content
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
'__ID__' => (is_object($object)?$object->id:''), $substitutionarray['__EMAIL__'] = $sendto;
'__EMAIL__' => $sendto, $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'';
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'', // Add specific substitution for contracts
'__REF__' => (is_object($object)?$object->ref:''), if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'') {
/* not available on all object $datenextexpiration='';
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''), foreach($object->lines as $line)
'__LASTNAME__'=>(is_object($object)?$object->lastname:''), {
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''), if ($line->statut != 4) continue;
'__ADDRESS__'=>(is_object($object)?$object->address:''), if ($line->date_fin_prevue > $datenextexpiration) $datenextexpiration = $line->date_fin_prevue;
'__ZIP__'=>(is_object($object)?$object->zip:''), }
'__TOWN_'=>(is_object($object)?$object->town:''), $substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
'__COUNTRY__'=>(is_object($object)?$object->country:''), $substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
*/ }
);
$parameters=array('mode'=>'formemail');
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
$subject=make_substitutions($subject, $substitutionarray); $subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray); $message=make_substitutions($message, $substitutionarray);

View File

@ -48,7 +48,7 @@ class Events // extends CommonObject
var $dateevent; var $dateevent;
var $description; var $description;
// List of all events supported by triggers // List of all Audit/Security events supported by triggers
var $eventstolog=array( var $eventstolog=array(
array('id'=>'USER_LOGIN', 'test'=>1), array('id'=>'USER_LOGIN', 'test'=>1),
array('id'=>'USER_LOGIN_FAILED', 'test'=>1), array('id'=>'USER_LOGIN_FAILED', 'test'=>1),

View File

@ -1082,7 +1082,7 @@ class Form
$sql.=")"; $sql.=")";
} }
$sql.=$this->db->order("nom","ASC"); $sql.=$this->db->order("nom","ASC");
if ($limit > 0) $sql.=$this->db->plimit($limit); $sql.=$this->db->plimit($limit, 0);
// Build output string // Build output string
dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG); dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG);
@ -1966,7 +1966,7 @@ class Form
$sql.= ' GROUP BY'.$selectFields; $sql.= ' GROUP BY'.$selectFields;
} }
$sql.= $db->order("p.ref"); $sql.= $db->order("p.ref");
$sql.= $db->plimit($limit); $sql.= $db->plimit($limit, 0);
// Build output string // Build output string
dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG); dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG);
@ -2390,7 +2390,7 @@ class Form
$sql.=')'; $sql.=')';
} }
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; $sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
$sql.= $db->plimit($limit); $sql.= $db->plimit($limit, 0);
// Build output string // Build output string
@ -5552,6 +5552,8 @@ class Form
print '<br><!-- showLinkedObjectBlock -->'; print '<br><!-- showLinkedObjectBlock -->';
print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, ''); print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder allwidth">'; print '<table class="noborder allwidth">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -5645,6 +5647,7 @@ class Form
} }
print '</table>'; print '</table>';
print '</div>';
return $nbofdifferenttypes; return $nbofdifferenttypes;
} }

View File

@ -166,7 +166,10 @@ class FormActions
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', '', '', ($max?($max+1):0)); $sortfield='a.datep';
$sortorder='DESC';
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max?($max+1):0));
if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions'); if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
$num = count($listofactions); $num = count($listofactions);
@ -192,19 +195,19 @@ class FormActions
$buttontoaddnewevent.= '</a>'; $buttontoaddnewevent.= '</a>';
print load_fiche_titre($title, $buttontoaddnewevent, ''); print load_fiche_titre($title, $buttontoaddnewevent, '');
$page=0; $param=''; $sortfield='a.datep'; $page=0; $param='';
$total = 0; $total = 0;
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder'.($morecss?' '.$morecss:'').'" width="100%">'; print '<table class="noborder'.($morecss?' '.$morecss:'').'" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], '', $page, $param, ''); print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print_liste_field_titre('Action', $_SERVER["PHP_SELF"], '', $page, $param, ''); print getTitleFieldOfList('Action', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', $page, $param, ''); print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, 'align="center"'); print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, 'align="center"', $sortfield, $sortorder, '', 1);
print_liste_field_titre('By', $_SERVER["PHP_SELF"], '', $page, $param, ''); print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"'); print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"', $sortfield, $sortorder, '', 1);
print '</tr>'; print '</tr>';
print "\n"; print "\n";

View File

@ -63,6 +63,7 @@ class FormMail extends Form
var $withtoccc; var $withtoccc;
var $withtopic; var $withtopic;
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
var $withmaindocfile; // 1=Add a checkbox "Attach also main document" for mass actions (checked by default), -1=Add checkbox (not checked by default)
var $withbody; var $withbody;
var $withfromreadonly; var $withfromreadonly;
@ -103,7 +104,8 @@ class FormMail extends Form
$this->withtoccc=0; $this->withtoccc=0;
$this->witherrorsto=0; $this->witherrorsto=0;
$this->withtopic=1; $this->withtopic=1;
$this->withfile=0; $this->withfile=0; // 1=Add section "Attached files". 2=Can add files.
$this->withmaindocfile=0; // 1=Add a checkbox "Attach also main document" for mass actions (checked by default), -1=Add checkbox (not checked by default)
$this->withbody=1; $this->withbody=1;
$this->withfromreadonly=1; $this->withfromreadonly=1;
@ -220,6 +222,7 @@ class FormMail extends Form
/** /**
* Show the form to input an email * Show the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
* this->withmaindocfile
* *
* @param string $addfileaction Name of action when posting file attachments * @param string $addfileaction Name of action when posting file attachments
* @param string $removefileaction Name of action when removing file attachments * @param string $removefileaction Name of action when removing file attachments
@ -233,6 +236,7 @@ class FormMail extends Form
/** /**
* Get the form to input an email * Get the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
* this->withfile
* this->param: Contains more parameteres like email templates info * this->param: Contains more parameteres like email templates info
* *
* @param string $addfileaction Name of action when posting file attachments * @param string $addfileaction Name of action when posting file attachments
@ -296,16 +300,25 @@ class FormMail extends Form
} }
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
//var_dump($this->param["models"]); //var_dump($this->param["models"]);
//var_dump($model_id);
//var_dump($arraydefaultmessage); //var_dump($arraydefaultmessage);
$out.= "\n".'<!-- Begin form mail --><div id="mailformdiv"></div>'."\n"; $out.= "\n".'<!-- Begin form mail type='.$this->param["models"].' --><div id="mailformdiv"></div>'."\n";
if ($this->withform == 1) if ($this->withform == 1)
{ {
$out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n"; $out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
$out.= '<a id="formmail" name="formmail"></a>';
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">'; $out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; $out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
$out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />'; $out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
$out.= '<a id="formmail" name="formmail"></a>'; }
if (! empty($this->withfrom))
{
if (! empty($this->withfromreadonly))
{
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
}
} }
foreach ($this->param as $key=>$value) foreach ($this->param as $key=>$value)
{ {
@ -330,7 +343,7 @@ class FormMail extends Form
if (count($modelmail_array)>0) if (count($modelmail_array)>0)
{ {
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n"; $out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1); $out.= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1); if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
$out.= ' &nbsp; '; $out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">'; $out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
@ -340,7 +353,7 @@ class FormMail extends Form
elseif (! empty($this->param['models']) && in_array($this->param['models'], array( elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
'propal_send','order_send','facture_send', 'propal_send','order_send','facture_send',
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send', 'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
'invoice_supplier_send','thirdparty','all' 'invoice_supplier_send','thirdparty','contract','all'
))) )))
{ {
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n"; $out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
@ -359,14 +372,17 @@ class FormMail extends Form
// Substitution array // Substitution array
if (! empty($this->withsubstit)) if (! empty($this->withsubstit))
{ {
$out.= '<tr><td colspan="2">'; $out.= '<tr><td colspan="2" align="right">';
//$out.='<div class="floatright">';
$help=""; $help="";
foreach($this->substit as $key => $val) foreach($this->substit as $key => $val)
{ {
$help.=$key.' -> '.$langs->trans($val).'<br>'; $help.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
} }
$out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help); if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
else $out.= $form->textwithpicto($langs->trans($this->withsubstit), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
//$out.='</div>';
} }
// From // From
@ -374,9 +390,7 @@ class FormMail extends Form
{ {
if (! empty($this->withfromreadonly)) if (! empty($this->withfromreadonly))
{ {
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />'; $out.= '<tr><td class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
$out.= '<tr><td width="180" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
if (! ($this->fromtype === 'user' && $this->fromid > 0) if (! ($this->fromtype === 'user' && $this->fromid > 0)
&& ! ($this->fromtype === 'company') && ! ($this->fromtype === 'company')
@ -429,10 +443,10 @@ class FormMail extends Form
} }
} }
$out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); $out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails);
//$out.= ajax_combobox('fromtype');
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
$out.= "</td></tr>\n";
} }
else else
{ {
@ -499,7 +513,7 @@ class FormMail extends Form
{ {
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
} }
$withtoselected=GETPOST("receiver"); // Array of selected value $withtoselected=GETPOST("receiver",'none'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend') if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend')
{ {
$withtoselected = array_keys($tmparray); $withtoselected = array_keys($tmparray);
@ -632,9 +646,12 @@ class FormMail extends Form
// Topic // Topic
if (! empty($this->withtopic)) if (! empty($this->withtopic))
{ {
$defaulttopic=""; $defaulttopic=GETPOST('subject','none');
if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1')
{
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic']; if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic'];
elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic; elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic;
}
$defaulttopic=make_substitutions($defaulttopic,$this->substit); $defaulttopic=make_substitutions($defaulttopic,$this->substit);
@ -660,6 +677,19 @@ class FormMail extends Form
$out.= '<td width="180">'.$langs->trans("MailFile").'</td>'; $out.= '<td width="180">'.$langs->trans("MailFile").'</td>';
$out.= '<td>'; $out.= '<td>';
if (! empty($this->withmaindocfile))
{
if ($this->withmaindocfile == 1)
{
$out.='<input type="checkbox" name="addmaindocfile" value="1" />';
}
if ($this->withmaindocfile == -1)
{
$out.='<input type="checkbox" name="addmaindocfile" checked="checked" />';
}
$out.=' '.$langs->trans("JoinMainDoc").'.<br>';
}
if (is_numeric($this->withfile)) if (is_numeric($this->withfile))
{ {
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
@ -685,7 +715,7 @@ class FormMail extends Form
$out.= '<br></div>'; $out.= '<br></div>';
} }
} }
else else if (empty($this->withmaindocfile)) // Do not show message if we asked to show the checkbox
{ {
$out.= $langs->trans("NoAttachedFiles").'<br>'; $out.= $langs->trans("NoAttachedFiles").'<br>';
} }
@ -701,15 +731,19 @@ class FormMail extends Form
{ {
$out.=$this->withfile; $out.=$this->withfile;
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
} }
// Message // Message
if (! empty($this->withbody)) if (! empty($this->withbody))
{ {
$defaultmessage=""; $defaultmessage=GETPOST('message','none');
if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1')
{
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) $defaultmessage=$arraydefaultmessage['content']; if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) $defaultmessage=$arraydefaultmessage['content'];
elseif (! is_numeric($this->withbody)) $defaultmessage=$this->withbody; elseif (! is_numeric($this->withbody)) $defaultmessage=$this->withbody;
}
// Complete substitution array // Complete substitution array
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL))
@ -835,11 +869,11 @@ class FormMail extends Form
/** /**
* Return template of email * Return templates of email with type = $type_template or type = 'all'
* Search into table c_email_templates * This search into table c_email_templates.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $type_template Get message for key module * @param string $type_template Get message for type=$type_template, type='all' also included.
* @param string $user Use template public or limited to this user * @param string $user Use template public or limited to this user
* @param Translate $outputlangs Output lang object * @param Translate $outputlangs Output lang object
* @param int $id Id template to find * @param int $id Id template to find
@ -852,9 +886,9 @@ class FormMail extends Form
$sql = "SELECT label, topic, content, content_lines, lang"; $sql = "SELECT label, topic, content, content_lines, lang";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template='".$db->escape($type_template)."'"; $sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")"; $sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
if ($active >= 0) $sql.=" AND active = ".$active; if ($active >= 0) $sql.=" AND active = ".$active;
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
if (!empty($id)) $sql.= " AND rowid=".$id; if (!empty($id)) $sql.= " AND rowid=".$id;
@ -873,7 +907,7 @@ class FormMail extends Form
$ret['content_lines']=$obj->content_lines; $ret['content_lines']=$obj->content_lines;
$ret['lang']=$obj->lang; $ret['lang']=$obj->lang;
} }
else else // If there is no template at all
{ {
$defaultmessage=''; $defaultmessage='';
if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); }
@ -997,17 +1031,19 @@ class FormMail extends Form
/** /**
* Set substit array from object * Set substit array from object. This is call when suggesting the email template into forms to send email.
* TODO Replace with getCommonSubstitutionArray with param onlykey = 2
* *
* @param CommonObject $object Object to use * @param CommonObject $object Object to use
* @param Translate $outputlangs Object lang * @param Translate $outputlangs Object lang
* @return void * @return void
* @see getCommonSubstitutionArray
*/ */
function setSubstitFromObject($object, $outputlangs=null) function setSubstitFromObject($object, $outputlangs=null)
{ {
global $conf, $user; global $conf, $user;
$this->substit['__REF__'] = $object->ref; $this->substit['__REF__'] = $object->ref;
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : ''; $this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : '');
$this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : ''; $this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : '';
$this->substit['__DATE_YMD__'] = isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : ''; $this->substit['__DATE_YMD__'] = isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '';
@ -1027,7 +1063,7 @@ class FormMail extends Form
$this->substit['__PERSONALIZED__'] = ''; $this->substit['__PERSONALIZED__'] = '';
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending $this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
// Create dinamic tags for __EXTRAFIELD_FIELD__ // Create dynamic tags for __EXTRAFIELD_FIELD__
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element, true); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals($object->id, $extralabels); $object->fetch_optionals($object->id, $extralabels);
@ -1073,13 +1109,14 @@ class FormMail extends Form
} }
/** /**
* Get list of substition keys available for emails. * Get list of substitution keys available for emails. This is used for tooltips help.
* This include the complete_substitutions_array. TODO Include the getCommonSubstitutionArray(). * This include the complete_substitutions_array.
* *
* @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ... * @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
* @param Object $object Object if applicable
* @return array Array of substitution values for emails. * @return array Array of substitution values for emails.
*/ */
static function getAvailableSubstitKey($mode='formemail') static function getAvailableSubstitKey($mode='formemail', $object=null)
{ {
global $conf, $langs; global $conf, $langs;
@ -1088,20 +1125,20 @@ class FormMail extends Form
if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines') if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines')
{ {
$vars=array( $vars=array(
'__REF__', '__REF__'=>'__REF__',
'__REFCLIENT__', '__REFCLIENT__'=>'__REFCLIENT__',
'__REFSUPPLIER__', '__REFSUPPLIER__'=>'__REFSUPPLIER__',
'__THIRDPARTY_ID__', '__THIRDPARTY_ID__'=>'__THIRDPARTY_ID__',
'__THIRDPARTY_NAME__', '__THIRDPARTY_NAME__'=>'__THIRDPARTY_NAME__',
'__PROJECT_ID__', '__PROJECT_ID__'=>'__PROJECT_ID__',
'__PROJECT_REF__', '__PROJECT_REF__'=>'__PROJECT_REF__',
'__PROJECT_NAME__', '__PROJECT_NAME__'=>'__PROJECT_NAME__',
'__CONTACTCIVNAME__', '__CONTACTCIVNAME__'=>'__CONTACTCIVNAME__',
'__AMOUNT__', '__AMOUNT__'=>'__AMOUNT__',
'__AMOUNT_WO_TAX__', '__AMOUNT_WO_TAX__'=>'__AMOUNT_WO_TAX__',
'__AMOUNT_VAT__', '__AMOUNT_VAT__'=>'__AMOUNT_VAT__',
'__PERSONALIZED__', // Paypal link will be added here in form mode '__PERSONALIZED__'=>'__PERSONALIZED__', // Paypal link will be added here in form mode
'__SIGNATURE__', '__SIGNATURE__'=>'__SIGNATURE__',
); );
if ($mode == 'formwithlines') if ($mode == 'formwithlines')
{ {
@ -1179,7 +1216,7 @@ class FormMail extends Form
} }
$parameters=array('mode'=>$mode); $parameters=array('mode'=>$mode);
$tmparray=getCommonSubstitutionArray($langs); $tmparray=getCommonSubstitutionArray($langs, 2, null, $object);
complete_substitutions_array($tmparray, $langs, null, $parameters); complete_substitutions_array($tmparray, $langs, null, $parameters);
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)
{ {

View File

@ -618,7 +618,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
$projecttmp = new Project($db); $projecttmp = new Project($db);
$i=0; $i=0;
$var=true;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -629,7 +629,6 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
if ($user->rights->projet->lire && $userAccess > 0) if ($user->rights->projet->lire && $userAccess > 0)
{ {
$var = !$var;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
@ -665,7 +664,6 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
} }
else else
{ {
$var = false;
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$db->free($result); $db->free($result);
@ -712,6 +710,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname"; if (! $sortfield) $sortfield="p.lastname";
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_status = '';
$search_name = '';
$search_addressphone = '';
$search_array_options=array();
}
$i=-1; $i=-1;
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
@ -741,29 +747,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print "\n".'<table class="noborder" width="100%">'."\n"; print "\n".'<table class="noborder" width="100%">'."\n";
$param="socid=".$object->id; $param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status; if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name); if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
$colspan=9;
print '<tr class="liste_titre">';
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
// Add to agenda
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
{
$colspan++;
print_liste_field_titre('');
}
// Edit
print_liste_field_titre('');
print "</tr>\n";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,"; $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,";
$sql .= " p.civility as civility_id, p.address, p.zip, p.town"; $sql .= " p.civility as civility_id, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
@ -778,14 +769,15 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$num = $db->num_rows($result); $num = $db->num_rows($result);
$var=true; $colspan=9;
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
if ($num || (GETPOST('button_search','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search_x','alpha')))
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Photo - Name // Photo - Name
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">'; print '<input type="text" class="flat minwidth75" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>'; print '</td>';
// Position // Position
@ -793,7 +785,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '</td>'; print '</td>';
// Address - Phone - Email // Address - Phone - Email
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre"></td>';
// Status // Status
print '<td class="liste_titre maxwidthonsmartphone">'; print '<td class="liste_titre maxwidthonsmartphone">';
@ -804,16 +796,31 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{ {
$colspan++; $colspan++;
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre"></td>';
} }
// Edit // Action
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; $searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
}
print '<tr class="liste_titre">';
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
// Add to agenda
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre('');
// Edit
print_liste_field_titre('');
print "</tr>\n";
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
{
$i=0; $i=0;
while ($i < $num) while ($i < $num)
@ -890,11 +897,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
} }
else else
{ {
print "<tr ".$bc[! $var].">"; print '<tr class="oddeven">';
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>'; print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
print "</tr>\n"; print "</tr>\n";
} }
print "\n</table>\n"; print "\n</table>\n";
print '</div>';
print '</form>'."\n"; print '</form>'."\n";
@ -943,12 +951,8 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
if ($num > 0) if ($num > 0)
{ {
$var=true;
foreach ($addressstatic->lines as $address) foreach ($addressstatic->lines as $address)
{ {
$var = !$var;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -1115,7 +1119,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
{ {
$i = 0 ; $i = 0 ;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$var=true;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -1162,7 +1166,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
} }
} }
// Add also event from emailings. FIXME This should be replaced by an automatic event // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
if (! empty($conf->mailing->enabled) && ! empty($objcon->email)) if (! empty($conf->mailing->enabled) && ! empty($objcon->email))
{ {
$langs->load("mails"); $langs->load("mails");
@ -1183,7 +1187,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
{ {
$i = 0 ; $i = 0 ;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$var=true;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -1304,7 +1308,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
$out.="<tr ".$bc[$var].">"; $out.='<tr class="oddeven">';
// Done or todo // Done or todo
if ($donetodo) if ($donetodo)
@ -1446,7 +1450,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
} }
// Status // Status
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,1,$histo[$key]['datestart']).'</td>'; $out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,0,$histo[$key]['datestart']).'</td>';
// Actions // Actions
$out.='<td></td>'; $out.='<td></td>';
@ -1503,12 +1507,10 @@ function show_subsidiaries($conf,$langs,$db,$object)
print "</tr>"; print "</tr>";
$i=0; $i=0;
$var=true;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var = !$var;
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -2283,6 +2283,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
} }
$original_file=$conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; $original_file=$conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} }
else if ($modulepart == 'massfilesarea_contract' && !empty($conf->contrat->dir_output))
{
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
$original_file=$conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
}
// Wrapping for interventions // Wrapping for interventions
else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output))

View File

@ -3353,16 +3353,16 @@ function dol_print_error_email($prefixcode, $errormessage='')
* @param string $field Field to use for new sorting * @param string $field Field to use for new sorting
* @param string $begin ("" by defaut) * @param string $begin ("" by defaut)
* @param string $moreparam Add more parameters on sort url links ("" by default) * @param string $moreparam Add more parameters on sort url links ("" by default)
* @param string $td Options of attribute td ("" by defaut, example: 'align="center"') * @param string $moreattrib Options of attribute td ("" by defaut, example: 'align="center"')
* @param string $sortfield Current field used to sort * @param string $sortfield Current field used to sort
* @param string $sortorder Current sort order * @param string $sortorder Current sort order
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
* @param string $tooltip Tooltip * @param string $tooltip Tooltip
* @return void * @return void
*/ */
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="", $tooltip="") function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
{ {
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix, 0, $tooltip); print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $moreattrib, $sortfield, $sortorder, $prefix, 0, $tooltip);
} }
/** /**
@ -3414,13 +3414,13 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
if ($field1 != $sortfield1) // We are on another field if ($field1 != $sortfield1) // We are on another field
{ {
if (preg_match('/^DESC/', $sortorder)) $out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'; if (preg_match('/^DESC/', $sortorder)) $out.= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">';
else $out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'; else $out.= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">';
} }
else // We are of first sorting criteria else // We are of first sorting criteria
{ {
if (preg_match('/^ASC/', $sortorder)) $out.= '<a href="'.$file.'?sortfield='.$sortfield.'&sortorder=desc&begin='.$begin.$options.'">'; if (preg_match('/^ASC/', $sortorder)) $out.= '<a class="reposition" href="'.$file.'?sortfield='.$sortfield.'&sortorder=desc&begin='.$begin.$options.'">';
else $out.= '<a href="'.$file.'?sortfield='.$sortfield.'&sortorder=asc&begin='.$begin.$options.'">'; else $out.= '<a class="reposition" href="'.$file.'?sortfield='.$sortfield.'&sortorder=asc&begin='.$begin.$options.'">';
} }
} }
@ -4823,20 +4823,25 @@ function picto_required()
/** /**
* Clean a string from all HTML tags and entities * Clean a string from all HTML tags and entities.
* This function differs from strip_tags because:
* - <br> are replace with \n
* - if entities are found, they are decoded before the strip
* - you can decide to convert line feed into spaces
* *
* @param string $StringHtml String to clean * @param string $stringtoclean String to clean
* @param integer $removelinefeed 1=Replace also new lines by a space, 0=Only last one are removed * @param integer $removelinefeed 1=Replace also new lines by a space, 0=Only last one are removed
* @param string $pagecodeto Encoding of input/output string * @param string $pagecodeto Encoding of input/output string
* @return string String cleaned * @return string String cleaned
* *
* @see dol_escape_htmltag * @see dol_escape_htmltag strip_tags
*/ */
function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
{ {
// TODO Try to replace with strip_tags($stringtoclean)
$pattern = "/<[^<>]+>/"; $pattern = "/<[^<>]+>/";
$StringHtml = preg_replace('/<br[^>]*>/', "\n", $StringHtml); $stringtoclean = preg_replace('/<br[^>]*>/', "\n", $stringtoclean);
$temp = dol_html_entity_decode($StringHtml,ENT_COMPAT,$pagecodeto); $temp = dol_html_entity_decode($stringtoclean,ENT_COMPAT,$pagecodeto);
// Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a> // Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
$temp = preg_replace($pattern,"",$temp); // pass 1 $temp = preg_replace($pattern,"",$temp); // pass 1
@ -4852,8 +4857,8 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
{ {
$temp = str_replace(" "," ",$temp); $temp = str_replace(" "," ",$temp);
} }
$CleanString = trim($temp);
return $CleanString; return trim($temp);
} }
@ -5186,20 +5191,27 @@ function dol_concatdesc($text1,$text2,$forxml=false)
/** /**
* Return array of possible common substitutions. * Return array of possible common substitutions. This includes several families like: 'system', 'mycompany', 'object', 'objectamount', 'date', 'user'
* *
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @param int $onlykey Do not calculate heavy values of keys (performance enhancement when we need only the keys) * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are trunc and html sanitized (to use for help tooltip)
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'objectamount', 'date', 'user', ...) * @param array $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
* @param Object $object Object for keys on object * @param Object $object Object for keys on object
* @return array Array of substitutions * @return array Array of substitutions
* @see setSubstitFromObject
*/ */
function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null) function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
{ {
global $conf, $mysoc, $user; global $db, $conf, $mysoc, $user;
$substitutionarray=array(); $substitutionarray=array();
if (empty($exclude) || ! in_array('system', $exclude))
{
$substitutionarray=array_merge($substitutionarray, array(
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT
));
}
if (empty($exclude) || ! in_array('mycompany', $exclude)) if (empty($exclude) || ! in_array('mycompany', $exclude))
{ {
$substitutionarray=array_merge($substitutionarray, array( $substitutionarray=array_merge($substitutionarray, array(
@ -5215,17 +5227,53 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
)); ));
} }
if (is_object($object) && (empty($exclude) || ! in_array('object', $exclude)))
{
$substitutionarray['__ID__'] = $object->id;
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
if (is_object($object->thirdparty) && $object->thirdparty->id > 0)
{
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
}
if (is_object($object->projet) && $object->projet->id > 0)
{
$substitutionarray['__PROJECT_ID__'] = (is_object($object->projet)?$object->projet->id:'');
$substitutionarray['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$substitutionarray['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
}
// Create dynamic tags for __EXTRAFIELD_FIELD__
if ($object->table_element && $object->id > 0)
{
$extrafieldstmp = new ExtraFields($db);
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals($object->id, $extralabels);
foreach ($extrafieldstmp->attribute_label as $key => $label) {
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
}
}
$substitutionarray['__ONLINE_PAYMENT_XXX__'] = 'todo';
}
if (empty($exclude) || ! in_array('objectamount', $exclude)) if (empty($exclude) || ! in_array('objectamount', $exclude))
{ {
if (is_object($object)) // For backward compatibility $substitutionarray['__DATE_YMD__'] = is_object($object)?(isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '') : '';
$substitutionarray['__DATE_DUE_YMD__'] = is_object($object)?(isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : '') : '';
$substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
$substitutionarray['__AMOUNT_WO_TAX__']= is_object($object)?$object->total_ht:'';
$substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
// For backward compatibility
if ($onlykey != 2)
{ {
$substitutionarray['__TOTAL_TTC__'] = is_object($object)?$object->total_ttc:''; $substitutionarray['__TOTAL_TTC__'] = is_object($object)?$object->total_ttc:'';
$substitutionarray['__TOTAL_HT__'] = is_object($object)?$object->total_ht:''; $substitutionarray['__TOTAL_HT__'] = is_object($object)?$object->total_ht:'';
$substitutionarray['__TOTAL_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):''; $substitutionarray['__TOTAL_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
} }
$substitutionarray['__AMOUNT__'] =is_object($object)?$object->total_ttc:'';
$substitutionarray['__AMOUNT_WO_TAX__']=is_object($object)?$object->total_ht:'';
$substitutionarray['__AMOUNT_VAT__'] =is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
} }
if (empty($exclude) || ! in_array('date', $exclude)) if (empty($exclude) || ! in_array('date', $exclude))
@ -5265,7 +5313,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__USER_LASTNAME__' => $user->lastname, '__USER_LASTNAME__' => $user->lastname,
'__USER_FIRSTNAME__' => $user->firstname, '__USER_FIRSTNAME__' => $user->firstname,
'__USER_FULLNAME__' => $user->getFullName($outputlangs), '__USER_FULLNAME__' => $user->getFullName($outputlangs),
'__USER_SUPERVISOR_ID__' => $user->fk_user '__USER_SUPERVISOR_ID__' => $user->fk_user,
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
)); ));
} }
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))

View File

@ -288,7 +288,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
{ {
// url = url from host, shorturl = relative path into dolibarr sources // url = url from host, shorturl = relative path into dolibarr sources
$url = $shorturl = $newTabMenu[$i]['url']; $url = $shorturl = $newTabMenu[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) // Do not change url content for external links
{ {
$tmp=explode('?',$newTabMenu[$i]['url'],2); $tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0]; $url = $shorturl = $tmp[0];
@ -323,7 +323,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
foreach($menu->liste as $menkey => $menuval) foreach($menu->liste as $menkey => $menuval)
{ {
if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']); if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url']!='#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry($menuval['enabled']); if (empty($noout)) print_end_menu_entry($menuval['enabled']);
} }
@ -664,7 +664,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
} }
// Contacts // Contacts
$newmenu->add("/societe/index.php?leftmenu=thirdparties", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ThirdParty") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts'); $newmenu->add("/societe/index.php?leftmenu=thirdparties", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts');
$newmenu->add("/contact/card.php?leftmenu=contacts&amp;action=create", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); $newmenu->add("/contact/card.php?leftmenu=contacts&amp;action=create", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer);
$newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire);
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire);

View File

@ -73,7 +73,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE ref like '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -73,7 +73,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -83,6 +83,7 @@ class pdf_strato extends ModelePDFContract
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf'; $this->type = 'pdf';
$formatarray=pdf_getFormat(); $formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width']; $this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height']; $this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
@ -465,17 +466,20 @@ class pdf_strato extends ModelePDFContract
if (empty($hidebottom)) if (empty($hidebottom))
{ {
$pdf->SetXY(20,230); $posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0); $posy = $tab_top + $tab_height + 3 + 3;
$pdf->SetXY(20,235); $pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell(80,25, '', 1); $pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0);
$pdf->SetXY(110,230); $pdf->SetXY($this->marge_gauche, $posy + 5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0); $pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 20, '', 1);
$pdf->SetXY(110,235); $pdf->SetXY($posmiddle + 5, $posy);
$pdf->MultiCell(80,25, '', 1); $pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0);
$pdf->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
} }
} }

View File

@ -72,7 +72,7 @@ class mod_contract_serpis extends ModelNumRefContracts
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -105,7 +105,7 @@ class mod_contract_serpis extends ModelNumRefContracts
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -71,7 +71,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -104,7 +104,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -72,7 +72,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -105,7 +105,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -89,7 +89,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixinvoice)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -111,7 +111,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(SUBSTRING(facnumber FROM ".$posindice.")) as max"; // This is standard SQL $sql = "SELECT MAX(SUBSTRING(facnumber FROM ".$posindice.")) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixcreditnote)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -87,7 +87,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixinvoice)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -109,7 +109,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixcreditnote)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -130,7 +130,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixdeposit)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixdeposit)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -74,7 +74,7 @@ class mod_pacific extends ModeleNumRefFicheinter
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -110,7 +110,7 @@ class mod_pacific extends ModeleNumRefFicheinter
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -60,8 +60,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
/** /**
* \class ModeleNumRefFicheinter * Classe mere des modeles de numerotation des references de fiches d'intervention
* \brief Classe mere des modeles de numerotation des references de fiches d'intervention
*/ */
abstract class ModeleNumRefFicheinter abstract class ModeleNumRefFicheinter
{ {

View File

@ -80,7 +80,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."livraison"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -114,7 +114,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."livraison"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -162,7 +162,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
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->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')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices')); if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'BuyingPrice','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin'));
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
@ -170,7 +170,7 @@ class modProduct extends DolibarrModules
$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.width'=>"Numeric",'p.height'=>"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'); $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.width'=>"Numeric",'p.height'=>"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->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')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
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','pf.quantity'=>'Numeric','pf.remise_percent'=>'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(); // We define here only fields that use another icon that the one defined into import_icon $this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon

View File

@ -73,7 +73,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -284,7 +284,7 @@ class printing_printgcp extends PrintingDriver
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $conf, $user, $db; global $conf, $user;
$error = 0; $error = 0;
$fileprint=$conf->{$module}->dir_output; $fileprint=$conf->{$module}->dir_output;
@ -293,7 +293,7 @@ class printing_printgcp extends PrintingDriver
$mimetype = dol_mimetype($fileprint); $mimetype = dol_mimetype($fileprint);
// select printer uri for module order, propal,... // select printer uri for module order, propal,...
$sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$module."' AND driver='printgcp' AND userid=".$user->id; $sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$module."' AND driver='printgcp' AND userid=".$user->id;
$result = $db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -315,7 +315,7 @@ class printing_printgcp extends PrintingDriver
} }
} }
} }
else dol_print_error($db); else dol_print_error($this->db);
$ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype); $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype);
$this->errors = 'PRINTGCP: '.mb_convert_encoding($ret['errormessage'], "UTF-8"); $this->errors = 'PRINTGCP: '.mb_convert_encoding($ret['errormessage'], "UTF-8");

View File

@ -77,7 +77,7 @@ class printing_printipp extends PrintingDriver
*/ */
function print_file($file, $module, $subdir='') function print_file($file, $module, $subdir='')
{ {
global $conf, $user, $db; global $conf, $user;
$error = 0; $error = 0;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
@ -92,7 +92,7 @@ class printing_printipp extends PrintingDriver
// select printer uri for module order, propal,... // select printer uri for module order, propal,...
$sql = "SELECT rowid,printer_id,copy FROM ".MAIN_DB_PREFIX."printing WHERE module = '".$module."' AND driver = 'printipp' AND userid = ".$user->id; $sql = "SELECT rowid,printer_id,copy FROM ".MAIN_DB_PREFIX."printing WHERE module = '".$module."' AND driver = 'printipp' AND userid = ".$user->id;
$result = $db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -116,7 +116,7 @@ class printing_printipp extends PrintingDriver
} }
} }
} }
else dol_print_error($db); else dol_print_error($this->db);
// Set number of copy // Set number of copy
$ipp->setCopies($obj->copy); $ipp->setCopies($obj->copy);

View File

@ -75,7 +75,7 @@ class mod_project_simple extends ModeleNumRefProjects
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet"; $sql.= " FROM ".MAIN_DB_PREFIX."projet";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -111,7 +111,7 @@ class mod_project_simple extends ModeleNumRefProjects
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet"; $sql.= " FROM ".MAIN_DB_PREFIX."projet";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -76,7 +76,7 @@ class mod_task_simple extends ModeleNumRefTask
$sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM " . $posindice . ") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM " . $posindice . ") AS SIGNED)) as max";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, "; $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, ";
$sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid"; $sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid";
$sql .= " AND task.ref LIKE '" . $this->db->escape($this->prefix) . "____-%'"; $sql .= " AND task.ref LIKE '" . $db->escape($this->prefix) . "____-%'";
$sql .= " AND project.entity = " . $conf->entity; $sql .= " AND project.entity = " . $conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -112,7 +112,7 @@ class mod_task_simple extends ModeleNumRefTask
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -75,7 +75,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."propal"; $sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -112,7 +112,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."propal"; $sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -159,7 +159,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$sql.= " WHERE "; $sql.= " WHERE ";
if ($type == 'customer') $sql.= "code_compta"; if ($type == 'customer') $sql.= "code_compta";
else if ($type == 'supplier') $sql.= "code_compta_fournisseur"; else if ($type == 'supplier') $sql.= "code_compta_fournisseur";
$sql.= " = '".$this->db->escape($code)."'"; $sql.= " = '".$db->escape($code)."'";
if (! empty($societe->id)) $sql.= " AND rowid <> ".$societe->id; if (! empty($societe->id)) $sql.= " AND rowid <> ".$societe->id;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -82,7 +82,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefixinvoice)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -103,7 +103,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefixcreditnote)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -124,7 +124,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefixdeposit)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefixdeposit)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -85,7 +85,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -120,7 +120,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -73,7 +73,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
$posindice=10; $posindice=10;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -75,7 +75,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal"; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -112,7 +112,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal"; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -0,0 +1,155 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* 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;
$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;
$listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
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;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$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($listofselectedthirdparties));
if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts
{
$liste = array();
$thirdpartyid = array_shift($listofselectedthirdparties);
$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->withto = $liste;
$formmail->withtofree = 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)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
$substitutionarray['__PERSONALIZED__'] = '';
$substitutionarray['__CONTACTCIVNAME__'] = '';
// Add specific substitution for contracts
if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
{
$datenextexpiration = '';
foreach ($object->lines as $line)
{
if ($line->statut != 4)
continue;
if ($line->date_fin_prevue > $datenextexpiration)
$datenextexpiration = $line->date_fin_prevue;
}
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
}
$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 ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>';
$arrayofmassactions = array();
}
else
{
print $formmail->get_form();
}
dol_fiche_end();

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
@ -111,6 +111,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0; $object->sendtoid=0;
} }
elseif ($action == 'CONTRACT_SENTBYMAIL')
{
$langs->load("agenda");
$langs->load("other");
$langs->load("contract");
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref);
if (empty($object->actionmsg))
{
$object->actionmsg=$langs->transnoentities("ContractSentByEMail",$object->ref);
}
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
}
elseif ($action == 'PROPAL_VALIDATE') elseif ($action == 'PROPAL_VALIDATE')
{ {
$langs->load("agenda"); $langs->load("agenda");

View File

@ -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.= " d.amount, d.fk_statut as statut, ";
$sql.= " p.rowid as pid, p.ref, p.title, p.public"; $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.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1"; $sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('don').")";
if ($statut != '' && $statut != '-1') if ($statut != '' && $statut != '-1')
{ {
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; $sql .= " AND d.fk_statut IN (".$db->escape($statut).")";

View File

@ -2084,7 +2084,7 @@ else
print '<td style="text-align:center;">'; print '<td style="text-align:center;">';
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">'; print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
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 '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">'; print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</td>'; print '</td>';
} }

View File

@ -322,6 +322,16 @@ if ($resql)
$title = $langs->trans("ListTripsAndExpenses"); $title = $langs->trans("ListTripsAndExpenses");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
if ($massaction == 'presend')
{
$topicmail="SendInterventionRef";
$modelmail="fichinter_send";
$objecttmp=new Intervention($db);
$trackid='int'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
}
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);

View File

@ -48,7 +48,7 @@ $langs->load('compta');
$langs->load('bills'); $langs->load('bills');
$langs->load('projects'); $langs->load('projects');
$action=GETPOST('action','alpha'); $action=GETPOST('action','aZ09');
$massaction=GETPOST('massaction','alpha'); $massaction=GETPOST('massaction','alpha');
$show_files=GETPOST('show_files','int'); $show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
@ -86,10 +86,6 @@ $optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int'); $billed = GETPOST('billed','int');
$search_project_ref=GETPOST('search_project_ref','alpha'); $search_project_ref=GETPOST('search_project_ref','alpha');
$page = GETPOST('page','int');
$sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha');
$status=GETPOST('statut','alpha'); $status=GETPOST('statut','alpha');
$billed=GETPOST('billed','int'); $billed=GETPOST('billed','int');
$viewstatut=GETPOST('viewstatut'); $viewstatut=GETPOST('viewstatut');
@ -114,11 +110,11 @@ if (! $sortorder) $sortorder='DESC';
if ($search_status == '') $search_status=-1; if ($search_status == '') $search_status=-1;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage context to save list fields
$contextpage='supplierorderlist'; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('orderlist')); $hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
@ -173,7 +169,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
*/ */
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; } if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array('socid'=>$socid); $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -207,6 +203,7 @@ if (empty($reshook))
$search_total_ht=''; $search_total_ht='';
$search_total_vat=''; $search_total_vat='';
$search_total_ttc=''; $search_total_ttc='';
$search_project_ref='';
$search_status=-1; $search_status=-1;
$orderyear=''; $orderyear='';
$ordermonth=''; $ordermonth='';
@ -216,16 +213,12 @@ if (empty($reshook))
$deliveryyear=''; $deliveryyear='';
$billed=''; $billed='';
$toselect=''; $toselect='';
$search_project_ref='';
$search_array_options=array(); $search_array_options=array();
}
// Mass actions if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
$objectclass='Commande'; || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
$objectlabel='Orders'; {
$permtoread = $user->rights->commande->lire; $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
$permtodelete = $user->rights->commande->supprimer;
$uploaddir = $conf->commande->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
// Mass actions // Mass actions
@ -581,7 +574,6 @@ if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_h
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); 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)
{ {
@ -650,6 +642,7 @@ if ($resql)
if ($search_total_ttc != '') $param.="&search_total_ttc=".$search_total_ttc; if ($search_total_ttc != '') $param.="&search_total_ttc=".$search_total_ttc;
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
if ($search_status >= 0) $param.="&search_status=".$search_status; if ($search_status >= 0) $param.="&search_status=".$search_status;
if ($search_project_ref >= 0) $param.="&search_project_ref=".$search_project_ref;
if ($billed != '') $param.="&billed=".$billed; if ($billed != '') $param.="&billed=".$billed;
if ($show_files) $param.='&show_files=' .$show_files; if ($show_files) $param.='&show_files=' .$show_files;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
@ -663,7 +656,7 @@ if ($resql)
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
@ -678,108 +671,24 @@ if ($resql)
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
// TODO Move this into an invluce
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails");
if (! GETPOST('cancel','alpha'))
{
$objecttmp=new CommandeFournisseur($db);
$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;
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
dol_fiche_head(null, '', '');
$topicmail="SendOrderRef"; $topicmail="SendOrderRef";
$modelmail="order_send"; $modelmail="order_supplier_send";
$objecttmp=new CommandeFournisseur($db);
$trackid='sord'.$object->id;
// Cree l'objet formulaire mail include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
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'){ if ($massaction == 'createbills')
$formmail->fromid = $user->id;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='ord'.$object->id;
}
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, 'ord'.$object->id);
}
$formmail->withfrom=1;
$liste=$langs->trans("AllRecipientSelected");
if (count($listofselectedthirdparties) == 1)
{
$liste=array();
$thirdpartyid=array_shift($listofselectedthirdparties);
$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->withto=$liste;
$formmail->withtofree=0;
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// 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;
print $formmail->get_form();
dol_fiche_end();
}
elseif ($massaction == 'createbills')
{ {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';

View File

@ -93,9 +93,12 @@ $day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int'); $month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int'); $year_lim = GETPOST('year_lim','int');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$filter = GETPOST('filtre','alpha');
$option = GETPOST('option'); $option = GETPOST('option');
if ($option == 'late') $filter = 'paye:0'; if ($option == 'late') {
$filter = 'paye:0';
}
$search_all = GETPOST('sall', 'alphanohtml'); $search_all = GETPOST('sall', 'alphanohtml');
$search_label = GETPOST("search_label","alpha"); $search_label = GETPOST("search_label","alpha");
@ -472,7 +475,7 @@ if ($resql)
); );
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$i = 0; $i = 0;
@ -491,102 +494,15 @@ if ($resql)
if ($massaction == 'presend') if ($massaction == 'presend')
{ {
$langs->load("mails");
if (! GETPOST('cancel','alpha'))
{
$objecttmp=new FactureFournisseur($db);
$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;
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
dol_fiche_head(null, '', '');
$topicmail="SendBillRef"; $topicmail="SendBillRef";
$modelmail="supplier_invoice_send"; $modelmail="supplier_invoice_send";
$objecttmp=new FactureFournisseur($db);
$trackid='sinv'.$object->id;
// Cree l'objet formulaire mail include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
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'){ if ($massaction == 'createbills')
$formmail->fromid = $user->id;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='sinv'.$object->id;
}
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, 'sinv'.$object->id);
}
$formmail->withfrom=1;
$liste=$langs->trans("AllRecipientSelected");
if (count($listofselectedthirdparties) == 1)
{
$liste=array();
$thirdpartyid=array_shift($listofselectedthirdparties);
$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->withto=$liste;
$formmail->withtofree=0;
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// 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;
print $formmail->get_form();
dol_fiche_end();
}
elseif ($massaction == 'createbills')
{ {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';

View File

@ -823,7 +823,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
dol_fiche_head(); dol_fiche_head();
//print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br /><br />'; //print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br><br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tbody>'; print '<tbody>';
@ -1281,14 +1281,14 @@ else
} else { } else {
print '<div class="tabBar">'; print '<div class="tabBar">';
print $langs->trans('ErrorUserViewCP'); print $langs->trans('ErrorUserViewCP');
print '<br /><br /><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
print '</div>'; print '</div>';
} }
} else { } else {
print '<div class="tabBar">'; print '<div class="tabBar">';
print $langs->trans('ErrorIDFicheCP'); print $langs->trans('ErrorIDFicheCP');
print '<br /><br /><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
print '</div>'; print '</div>';
} }

View File

@ -365,7 +365,7 @@ else
print $langs->trans("InstallEasy")." "; print $langs->trans("InstallEasy")." ";
print $langs->trans("ChooseYourSetupMode"); print $langs->trans("ChooseYourSetupMode");
print '<br /><br />'; print '<br><br>';
$foundrecommandedchoice=0; $foundrecommandedchoice=0;
@ -534,13 +534,13 @@ else
if (count($notavailable_choices)) { if (count($notavailable_choices)) {
print '<br />'; print '<br>';
print '<div id="AShowChoices">'; print '<div id="AShowChoices">';
print '<img src="../theme/eldy/img/1downarrow.png"> <a href="#">'.$langs->trans('ShowNotAvailableOptions').'</a>'; print '<img src="../theme/eldy/img/1downarrow.png"> <a href="#">'.$langs->trans('ShowNotAvailableOptions').'</a>';
print '</div>'; print '</div>';
print '<div id="navail_choices" style="display:none">'; print '<div id="navail_choices" style="display:none">';
print '<br />'; print '<br>';
print '<table width="100%" class="listofchoices">'; print '<table width="100%" class="listofchoices">';
foreach ($notavailable_choices as $choice) { foreach ($notavailable_choices as $choice) {
print $choice; print $choice;

View File

@ -65,6 +65,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22);

View File

@ -41,6 +41,9 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
-- For 7.0 -- For 7.0
ALTER TABLE llx_product MODIFY COLUMN seuil_stock_alerte integer DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN seuil_stock_alerte SET DEFAULT NULL;
ALTER TABLE llx_facture_rec ADD COLUMN suspended integer DEFAULT 0; ALTER TABLE llx_facture_rec ADD COLUMN suspended integer DEFAULT 0;
ALTER TABLE llx_facture_rec MODIFY COLUMN titre VARCHAR(100); ALTER TABLE llx_facture_rec MODIFY COLUMN titre VARCHAR(100);
@ -242,6 +245,8 @@ ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128); ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
ALTER TABLE llx_actioncomm MODIFY COLUMN label varchar(255) NOT NULL;
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code; ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK'; UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
@ -256,6 +261,7 @@ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE'
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS'; UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS'; UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS';
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
CREATE TABLE llx_projet_task_comment ( CREATE TABLE llx_projet_task_comment (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,

View File

@ -52,17 +52,17 @@ create table llx_actioncomm
location varchar(128), location varchar(128),
durationp real, -- planed duration durationp real, -- planed duration
label varchar(256) NOT NULL, -- label/title of event or topic of email label varchar(255) NOT NULL, -- label/title of event or topic of email
note text, -- note of event or content of email note text, -- note of event or content of email
email_subject varchar(256), -- when event was an email, we store here the subject. content is stored into note. email_subject varchar(255), -- when event was an email, we store here the subject. content is stored into note.
email_msgid varchar(256), -- when event was an email, we store here the msgid email_msgid varchar(255), -- when event was an email, we store here the msgid
email_from varchar(256), -- when event was an email, we store here the from email_from varchar(255), -- when event was an email, we store here the from
email_sender varchar(256), -- when event was an email, we store here the sender email_sender varchar(255), -- when event was an email, we store here the sender
email_to varchar(256), -- when event was an email, we store here the email_to email_to varchar(255), -- when event was an email, we store here the email_to
email_tocc varchar(256), -- when event was an email, we store here the email_tocc email_tocc varchar(255), -- when event was an email, we store here the email_tocc
email_tobcc varchar(256), -- when event was an email, we store here the email_tobcc email_tobcc varchar(255), -- when event was an email, we store here the email_tobcc
errors_to varchar(256), -- when event was an email, we store here the erros_to errors_to varchar(255), -- when event was an email, we store here the erros_to
recurid varchar(128), -- used to store event id to link each other all the repeating event record recurid varchar(128), -- used to store event id to link each other all the repeating event record
recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO'

View File

@ -60,7 +60,7 @@ create table llx_product
tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch management (eat-by or lot management) tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch management (eat-by or lot management)
fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module) fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module)
duration varchar(6), duration varchar(6),
seuil_stock_alerte integer DEFAULT 0, seuil_stock_alerte integer DEFAULT NULL,
url varchar(255), url varchar(255),
barcode varchar(255) DEFAULT NULL, -- barcode barcode varchar(255) DEFAULT NULL, -- barcode
fk_barcode_type integer DEFAULT NULL, -- barcode type fk_barcode_type integer DEFAULT NULL, -- barcode type

View File

@ -132,7 +132,7 @@ MaxNbOfLinesForBoxes=Max number of lines for widgets
PositionByDefault=Default order PositionByDefault=Default order
Position=Position Position=Position
MenusDesc=Menu managers set content of the two menu bars (horizontal and vertical). MenusDesc=Menu managers set content of the two menu bars (horizontal and vertical).
MenusEditorDesc=The menu editor allows you to define custom menu entries. Use it carefully to avoid instability and permanently unreachable menu entries.<br />Some modules add menu entries (in menu <b>All</b> mostly). If you remove some of these entries by mistake, you can restore them disabling and reenabling the module. MenusEditorDesc=The menu editor allows you to define custom menu entries. Use it carefully to avoid instability and permanently unreachable menu entries.<br>Some modules add menu entries (in menu <b>All</b> mostly). If you remove some of these entries by mistake, you can restore them disabling and reenabling the module.
MenuForUsers=Menu for users MenuForUsers=Menu for users
LangFile=.lang file LangFile=.lang file
System=System System=System
@ -313,7 +313,7 @@ SetupIsReadyForUse=Module deployment is finished. You must however enable and se
NotExistsDirect=The alternative root directory is not defined to an existing directory.<br> NotExistsDirect=The alternative root directory is not defined to an existing directory.<br>
InfDirAlt=Since version 3, it is possible to define an alternative root directory. This allows you to store, into a dedicated directory, plug-ins and custom templates.<br>Just create a directory at the root of Dolibarr (eg: custom).<br> InfDirAlt=Since version 3, it is possible to define an alternative root directory. This allows you to store, into a dedicated directory, plug-ins and custom templates.<br>Just create a directory at the root of Dolibarr (eg: custom).<br>
InfDirExample=<br>Then declare it in the file <strong>conf.php</strong><br> $dolibarr_main_url_root_alt='/custom'<br>$dolibarr_main_document_root_alt='/path/of/dolibarr/htdocs/custom'<br>If these lines are commented with "#", to enable them, just uncomment by removing the "#" character. InfDirExample=<br>Then declare it in the file <strong>conf.php</strong><br> $dolibarr_main_url_root_alt='/custom'<br>$dolibarr_main_document_root_alt='/path/of/dolibarr/htdocs/custom'<br>If these lines are commented with "#", to enable them, just uncomment by removing the "#" character.
YouCanSubmitFile=For this step, you can submit your package file here : YouCanSubmitFile=For this step, you can submit the .zip file of module package here :
CurrentVersion=Dolibarr current version CurrentVersion=Dolibarr current version
CallUpdatePage=Go to the page that updates the database structure and data: %s. CallUpdatePage=Go to the page that updates the database structure and data: %s.
LastStableVersion=Latest stable version LastStableVersion=Latest stable version

View File

@ -66,6 +66,7 @@ OrderApprovedInDolibarr=Order %s approved
OrderRefusedInDolibarr=Order %s refused OrderRefusedInDolibarr=Order %s refused
OrderBackToDraftInDolibarr=Order %s go back to draft status OrderBackToDraftInDolibarr=Order %s go back to draft status
ProposalSentByEMail=Commercial proposal %s sent by EMail ProposalSentByEMail=Commercial proposal %s sent by EMail
ContractSentByEMail=Contract %s sent by EMail
OrderSentByEMail=Customer order %s sent by EMail OrderSentByEMail=Customer order %s sent by EMail
InvoiceSentByEMail=Customer invoice %s sent by EMail InvoiceSentByEMail=Customer invoice %s sent by EMail
SupplierOrderSentByEMail=Supplier order %s sent by EMail SupplierOrderSentByEMail=Supplier order %s sent by EMail

View File

@ -331,7 +331,7 @@ ListOfNextSituationInvoices=List of next situation invoices
FrequencyPer_d=Every %s days FrequencyPer_d=Every %s days
FrequencyPer_m=Every %s months FrequencyPer_m=Every %s months
FrequencyPer_y=Every %s years FrequencyPer_y=Every %s years
toolTipFrequency=Examples:<br /><b>Set 7, Day</b>: give a new invoice every 7 days<br /><b>Set 3, Month</b>: give a new invoice every 3 month toolTipFrequency=Examples:<br><b>Set 7, Day</b>: give a new invoice every 7 days<br><b>Set 3, Month</b>: give a new invoice every 3 month
NextDateToExecution=Date for next invoice generation NextDateToExecution=Date for next invoice generation
DateLastGeneration=Date of latest generation DateLastGeneration=Date of latest generation
MaxPeriodNumber=Max nb of invoice generation MaxPeriodNumber=Max nb of invoice generation

View File

@ -222,3 +222,4 @@ WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Pleas
WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent. WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent.
WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action. WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action.
WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language
WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to <b>%s</b> when using the bulk actions on lists

View File

@ -49,6 +49,7 @@ NbOfUniqueEMails=Nb of unique emails
NbOfEMails=Nb of EMails NbOfEMails=Nb of EMails
TotalNbOfDistinctRecipients=Number of distinct recipients TotalNbOfDistinctRecipients=Number of distinct recipients
NoTargetYet=No recipients defined yet (Go on tab 'Recipients') NoTargetYet=No recipients defined yet (Go on tab 'Recipients')
NoRecipientEmail=No recipient email for %s
RemoveRecipient=Remove recipient RemoveRecipient=Remove recipient
YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/core/modules/mailings/README. YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/core/modules/mailings/README.
EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values
@ -69,7 +70,7 @@ EMailSentToNRecipients=EMail sent to %s recipients.
EMailSentForNElements=EMail sent for %s elements. EMailSentForNElements=EMail sent for %s elements.
XTargetsAdded=<b>%s</b> recipients added into target list XTargetsAdded=<b>%s</b> recipients added into target list
OnlyPDFattachmentSupported=If the PDF document was already generated for the object to send, it will be attached to email. If not, no email will be sent (also, note that only pdf documents are supported as attachment in mass sending in this version). OnlyPDFattachmentSupported=If the PDF document was already generated for the object to send, it will be attached to email. If not, no email will be sent (also, note that only pdf documents are supported as attachment in mass sending in this version).
AllRecipientSelected=All thirdparties selected and if an email is set. AllRecipientSelected=The %s thirdparties selected, and if an email is set.
ResultOfMailSending=Result of mass EMail sending ResultOfMailSending=Result of mass EMail sending
NbSelected=Nb selected NbSelected=Nb selected
NbIgnored=Nb ignored NbIgnored=Nb ignored

View File

@ -540,6 +540,7 @@ MonthShort10=Oct
MonthShort11=Nov MonthShort11=Nov
MonthShort12=Dec MonthShort12=Dec
AttachedFiles=Attached files and documents AttachedFiles=Attached files and documents
JoinMainDoc=Join main document
DateFormatYYYYMM=YYYY-MM DateFormatYYYYMM=YYYY-MM
DateFormatYYYYMMDD=YYYY-MM-DD DateFormatYYYYMMDD=YYYY-MM-DD
DateFormatYYYYMMDDHHMM=YYYY-MM-DD HH:SS DateFormatYYYYMMDDHHMM=YYYY-MM-DD HH:SS
@ -844,7 +845,7 @@ Select2NotFound=No result found
Select2Enter=Enter Select2Enter=Enter
Select2MoreCharacter=or more character Select2MoreCharacter=or more character
Select2MoreCharacters=or more characters Select2MoreCharacters=or more characters
Select2MoreCharactersMore=<strong>Search syntax:</strong><br /><kbd><strong> |</strong></kbd><kbd> OR</kbd> (a|b)<br /><kbd><strong>*</strong></kbd><kbd> Any character</kbd> (a*b)<br /><kbd><strong>^</strong></kbd><kbd> Start with</kbd> (^ab)<br /><kbd><strong>$</strong></kbd><kbd> End with</kbd> (ab$)<br /> Select2MoreCharactersMore=<strong>Search syntax:</strong><br><kbd><strong> |</strong></kbd><kbd> OR</kbd> (a|b)<br><kbd><strong>*</strong></kbd><kbd> Any character</kbd> (a*b)<br /><kbd><strong>^</strong></kbd><kbd> Start with</kbd> (^ab)<br /><kbd><strong>$</strong></kbd><kbd> End with</kbd> (ab$)<br />
Select2LoadingMoreResults=Loading more results... Select2LoadingMoreResults=Loading more results...
Select2SearchInProgress=Search in progress... Select2SearchInProgress=Search in progress...
SearchIntoThirdparties=Thirdparties SearchIntoThirdparties=Thirdparties

View File

@ -7,7 +7,7 @@ multicurrency_syncronize_error=Synchronisation error: %s
MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE=Use date of document to find currency rate, instead of using latest known rate MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE=Use date of document to find currency rate, instead of using latest known rate
multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the latest known rate) multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the latest known rate)
CurrencyLayerAccount=CurrencyLayer API CurrencyLayerAccount=CurrencyLayer API
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br />Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br>Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month
multicurrency_appId=API key multicurrency_appId=API key
multicurrency_appCurrencySource=Currency source multicurrency_appCurrencySource=Currency source
multicurrency_alternateCurrencySource=Alternate currency source multicurrency_alternateCurrencySource=Alternate currency source

View File

@ -3,7 +3,7 @@ SecurityCode=Security code
NumberingShort=N° NumberingShort=N°
Tools=Tools Tools=Tools
TMenuTools=Tools TMenuTools=Tools
ToolsDesc=All miscellaneous tools not included in other menu entries are collected here.<br /><br />All the tools can be reached in the left menu. ToolsDesc=All miscellaneous tools not included in other menu entries are collected here.<br><br>All the tools can be reached in the left menu.
Birthday=Birthday Birthday=Birthday
BirthdayDate=Birthday date BirthdayDate=Birthday date
DateToBirth=Date of birth DateToBirth=Date of birth
@ -162,9 +162,9 @@ SizeUnitinch=inch
SizeUnitfoot=foot SizeUnitfoot=foot
SizeUnitpoint=point SizeUnitpoint=point
BugTracker=Bug tracker BugTracker=Bug tracker
SendNewPasswordDesc=This form allows you to request a new password. It will be sent to your email address.<br />Change will become effective once you click on the confirmation link in the email.<br />Check your inbox. SendNewPasswordDesc=This form allows you to request a new password. It will be sent to your email address.<br>Change will become effective once you click on the confirmation link in the email.<br />Check your inbox.
BackToLoginPage=Back to login page BackToLoginPage=Back to login page
AuthenticationDoesNotAllowSendNewPassword=Authentication mode is <b>%s</b>.<br />In this mode, Dolibarr can't know nor change your password.<br />Contact your system administrator if you want to change your password. AuthenticationDoesNotAllowSendNewPassword=Authentication mode is <b>%s</b>.<br>In this mode, Dolibarr can't know nor change your password.<br />Contact your system administrator if you want to change your password.
EnableGDLibraryDesc=Install or enable GD library on your PHP installation to use this option. EnableGDLibraryDesc=Install or enable GD library on your PHP installation to use this option.
ProfIdShortDesc=<b>Prof Id %s</b> is an information depending on third party country.<br>For example, for country <b>%s</b>, it's code <b>%s</b>. ProfIdShortDesc=<b>Prof Id %s</b> is an information depending on third party country.<br>For example, for country <b>%s</b>, it's code <b>%s</b>.
DolibarrDemo=Dolibarr ERP/CRM demo DolibarrDemo=Dolibarr ERP/CRM demo

View File

@ -49,7 +49,7 @@ EnhancedValue=Value
PMPValue=Weighted average price PMPValue=Weighted average price
PMPValueShort=WAP PMPValueShort=WAP
EnhancedValueOfWarehouses=Warehouses value EnhancedValueOfWarehouses=Warehouses value
UserWarehouseAutoCreate=Create a warehouse automatically when creating a user UserWarehouseAutoCreate=Create a user warehouse automatically when creating a user
AllowAddLimitStockByWarehouse=Allow to add limit and desired stock per couple (product, warehouse) instead of per product AllowAddLimitStockByWarehouse=Allow to add limit and desired stock per couple (product, warehouse) instead of per product
IndependantSubProductStock=Product stock and subproduct stock are independant IndependantSubProductStock=Product stock and subproduct stock are independant
QtyDispatched=Quantity dispatched QtyDispatched=Quantity dispatched
@ -71,7 +71,7 @@ NoPredefinedProductToDispatch=No predefined products for this object. So no disp
DispatchVerb=Dispatch DispatchVerb=Dispatch
StockLimitShort=Limit for alert StockLimitShort=Limit for alert
StockLimit=Stock limit for alert StockLimit=Stock limit for alert
StockLimitDesc="" (empty) default value means no alert. <br>"0" can be used with 'Stock can be negative' configuration. StockLimitDesc=(empty) means no warning.<br>0 can be used for a warning as soon as stock is empty.
PhysicalStock=Physical stock PhysicalStock=Physical stock
RealStock=Real Stock RealStock=Real Stock
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements. RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements.
@ -175,7 +175,7 @@ SelectFournisseur=Supplier filter
inventoryOnDate=Inventory inventoryOnDate=Inventory
INVENTORY_DISABLE_VIRTUAL=Allow to not destock child product from a kit on inventory INVENTORY_DISABLE_VIRTUAL=Allow to not destock child product from a kit on inventory
INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Use the buy price if no last buy price can be found INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Use the buy price if no last buy price can be found
INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT=Stock mouvment have date of inventory INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT=Stock movement have date of inventory
inventoryChangePMPPermission=Allow to change PMP value for a product inventoryChangePMPPermission=Allow to change PMP value for a product
ColumnNewPMP=New unit PMP ColumnNewPMP=New unit PMP
OnlyProdsInStock=Do not add product without stock OnlyProdsInStock=Do not add product without stock

View File

@ -339,7 +339,7 @@ class MyObject extends CommonObject
* Return the status * Return the status
* *
* @param int $status Id status * @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
static function LibStatut($status,$mode=0) static function LibStatut($status,$mode=0)

View File

@ -293,13 +293,13 @@ jQuery(document).ready(function() {
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
foreach($search as $key => $val) foreach($search as $key => $val)
{ {
$param.= '&search_'.$key.'='.urlencode($search[$key]); $param.= '&search_'.$key.'='.urlencode($search[$key]);
} }
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {

View File

@ -600,7 +600,7 @@ if (GETPOST('ajoutsujet'))
} }
if ($user->rights->opensurvey->write) { if ($user->rights->opensurvey->write) {
print '<br />'.$langs->trans("PollAdminDesc", img_picto('','delete'), $langs->trans("Add")).'<br>'; print '<br>'.$langs->trans("PollAdminDesc", img_picto('','delete'), $langs->trans("Add")).'<br>';
} }
$nbcolonnes=substr_count($object->sujet,',')+1; $nbcolonnes=substr_count($object->sujet,',')+1;

View File

@ -178,11 +178,11 @@ print '<input type="checkbox" name="mailsonde" '.$cochemail.'> '. $langs->trans(
if ($_SESSION['allow_comments']) $allow_comments = 'checked'; if ($_SESSION['allow_comments']) $allow_comments = 'checked';
if (isset($_POST['allow_comments'])) $allow_comments=GETPOST('allow_comments')?'checked':''; if (isset($_POST['allow_comments'])) $allow_comments=GETPOST('allow_comments')?'checked':'';
print '<input type="checkbox" name="allow_comments" '.$allow_comments.'"> '.$langs->trans('CanComment').'<br />'."\n"; print '<input type="checkbox" name="allow_comments" '.$allow_comments.'"> '.$langs->trans('CanComment').'<br>'."\n";
if ($_SESSION['allow_spy']) $allow_spy = 'checked'; if ($_SESSION['allow_spy']) $allow_spy = 'checked';
if (isset($_POST['allow_spy'])) $allow_spy=GETPOST('allow_spy')?'checked':''; if (isset($_POST['allow_spy'])) $allow_spy=GETPOST('allow_spy')?'checked':'';
print '<input type="checkbox" name="allow_spy" '.$allow_spy.'> '.$langs->trans('CanSeeOthersVote').'<br />'."\n"; print '<input type="checkbox" name="allow_spy" '.$allow_spy.'> '.$langs->trans('CanSeeOthersVote').'<br>'."\n";
if (GETPOST('choix_sondage')) if (GETPOST('choix_sondage'))
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -142,7 +142,7 @@ if ($action == 'search')
{ {
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type as type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem'; $sql.= ' p.fk_product_type, p.tms as datem';
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm'; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref))
// Nature // Nature
if ($object->type!=Product::TYPE_SERVICE) if ($object->type!=Product::TYPE_SERVICE)
{ {
print '<tr><td>'.$langs->trans("Nature").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td>';
print $object->getLibFinished(); print $object->getLibFinished();
print '</td></tr>'; print '</td></tr>';
} }
@ -228,7 +228,7 @@ if ($id > 0 || ! empty($ref))
if (empty($conf->global->PRODUIT_MULTIPRICES)) if (empty($conf->global->PRODUIT_MULTIPRICES))
{ {
// Price // Price
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("SellingPrice").'</td><td>';
if ($object->price_base_type == 'TTC') if ($object->price_base_type == 'TTC')
{ {
print price($object->price_ttc).' '.$langs->trans($object->price_base_type); print price($object->price_ttc).' '.$langs->trans($object->price_base_type);
@ -552,6 +552,7 @@ if ($id > 0 || ! empty($ref))
// check if a product is not already a parent product of this one // check if a product is not already a parent product of this one
$prod_arbo=new Product($db); $prod_arbo=new Product($db);
$prod_arbo->id=$objp->rowid; $prod_arbo->id=$objp->rowid;
// This type is not supported (not required to have virtual products working).
if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT) if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT)
{ {
$is_pere=0; $is_pere=0;
@ -575,7 +576,8 @@ if ($id > 0 || ! empty($ref))
} }
} }
print "\n<tr ".$bc[$var].">"; print "\n".'<tr class="oddeven">';
$productstatic->id=$objp->rowid; $productstatic->id=$objp->rowid;
$productstatic->ref=$objp->ref; $productstatic->ref=$objp->ref;
$productstatic->label=$objp->label; $productstatic->label=$objp->label;

View File

@ -199,7 +199,7 @@
<?php } ?> <?php } ?>
</form> </form>
<p>Date de création : <?php echo $object->getDate('datec') ?> <p>Date de création : <?php echo $object->getDate('datec') ?>
<br />Dernière mise à jour : <?php echo $object->getDate('tms') ?></p> <br>Dernière mise à jour : <?php echo $object->getDate('tms') ?></p>

View File

@ -962,7 +962,7 @@ class MouvementStock extends CommonObject
$label = '<u>' . $langs->trans("Movement") . ' '.$this->id.'</u>'; $label = '<u>' . $langs->trans("Movement") . ' '.$this->id.'</u>';
$label.= '<div width="100%">'; $label.= '<div width="100%">';
$label.= '<b>' . $langs->trans('Label') . ':</b> ' . $this->label; $label.= '<b>' . $langs->trans('Label') . ':</b> ' . $this->label;
$label.= '<br /><b>' . $langs->trans('Qty') . ':</b> ' .$this->qty; $label.= '<br><b>' . $langs->trans('Qty') . ':</b> ' .$this->qty;
$label.= '</div>'; $label.= '</div>';
$link = '<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$this->warehouse_id.'&msid='.$this->id.'"'; $link = '<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$this->warehouse_id.'&msid='.$this->id.'"';

View File

@ -946,7 +946,6 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
{ {
print '<br><br>'; print '<br><br>';
print_titre($langs->trans('AddNewProductStockWarehouse')); print_titre($langs->trans('AddNewProductStockWarehouse'));
//print '<br />';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="action" value="addlimitstockwarehouse">'; print '<input type="hidden" name="action" value="addlimitstockwarehouse">';

View File

@ -195,7 +195,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
<dt>pGroup</dt><dd>(optional) indicates whether this is a group task (parent) - Numeric; 0 = normal task, 1 = standard group task, 2 = combined group task<a href='#combinedtasks' class="footnote">*</a></dd> <dt>pGroup</dt><dd>(optional) indicates whether this is a group task (parent) - Numeric; 0 = normal task, 1 = standard group task, 2 = combined group task<a href='#combinedtasks' class="footnote">*</a></dd>
<dt>pParent</dt><dd>(required) identifies a parent pID, this causes this task to be a child of identified task. Numeric, top level tasks should have pParent set to 0</dd> <dt>pParent</dt><dd>(required) identifies a parent pID, this causes this task to be a child of identified task. Numeric, top level tasks should have pParent set to 0</dd>
<dt>pOpen</dt><dd>(required) indicates whether a standard group task is open when chart is first drawn. Value must be set for all items but is only used by standard group tasks. Numeric, 1 = open, 0 = closed</dd> <dt>pOpen</dt><dd>(required) indicates whether a standard group task is open when chart is first drawn. Value must be set for all items but is only used by standard group tasks. Numeric, 1 = open, 0 = closed</dd>
<dt>pDepend</dt><dd>(optional) comma separated list of id&#39;s this task is dependent on. A line will be drawn from each listed task to this item<br />Each id can optionally be followed by a dependency type suffix. Valid values are:<blockquote>'FS' - Finish to Start (default if suffix is omitted)<br />'SF' - Start to Finish<br />'SS' - Start to Start<br />'FF' - Finish to Finish</blockquote>If present the suffix must be added directly to the id e.g. '123SS'</dd> <dt>pDepend</dt><dd>(optional) comma separated list of id&#39;s this task is dependent on. A line will be drawn from each listed task to this item<br>Each id can optionally be followed by a dependency type suffix. Valid values are:<blockquote>'FS' - Finish to Start (default if suffix is omitted)<br />'SF' - Start to Finish<br />'SS' - Start to Start<br />'FF' - Finish to Finish</blockquote>If present the suffix must be added directly to the id e.g. '123SS'</dd>
<dt>pCaption</dt><dd>(optional) caption that will be added after task bar if CaptionType set to "Caption"</dd> <dt>pCaption</dt><dd>(optional) caption that will be added after task bar if CaptionType set to "Caption"</dd>
<dt>pNotes</dt><dd>(optional) Detailed task information that will be displayed in tool tip for this task</dd> <dt>pNotes</dt><dd>(optional) Detailed task information that will be displayed in tool tip for this task</dd>
<dt>pGantt</dt><dd>(required) javascript JSGantt.GanttChart object from which to take settings. Defaults to &quot;g&quot; for backwards compatibility</dd> <dt>pGantt</dt><dd>(required) javascript JSGantt.GanttChart object from which to take settings. Defaults to &quot;g&quot; for backwards compatibility</dd>

View File

@ -440,7 +440,7 @@ else
{ {
$element_prop = getElementProperties($resource_obj); $element_prop = getElementProperties($resource_obj);
//print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br />'; //print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br>';
$path = ''; $path = '';
if(strpos($resource_obj,'@')) if(strpos($resource_obj,'@'))

View File

@ -2484,10 +2484,11 @@ else
$formmail->withbody=1; $formmail->withbody=1;
$formmail->withdeliveryreceipt=1; $formmail->withdeliveryreceipt=1;
$formmail->withcancel=1; $formmail->withcancel=1;
// Tableau des substitutions // Array of substitutions
//$formmail->setSubstitFromObject($object); $formmail->withsubstit='AvailableVariables';
$formmail->substit['__THIRDPARTY_NAME__']=$object->name; $formmail->setSubstitFromObject($object);
$formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__THIRDPARTY_ID__']=$object->id; // substit in setSubstitFromObject was wrong for this one
$formmail->substit['__THIRDPARTY_NAME__']=$object->name; // substit in setSubstitFromObject was wrong for this one
$formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']=''; $formmail->substit['__CONTACTCIVNAME__']='';

View File

@ -1908,6 +1908,7 @@ class Societe extends CommonObject
{ {
$label.= '<br><b>' . $langs->trans('Name') . ':</b> '. $this->name; $label.= '<br><b>' . $langs->trans('Name') . ':</b> '. $this->name;
if (! empty($this->name_alias)) $label.=' ('.$this->name_alias.')'; if (! empty($this->name_alias)) $label.=' ('.$this->name_alias.')';
$label.= '<br><b>' . $langs->trans('Email') . ':</b> '. $this->email;
} }
if (! empty($this->country_code)) if (! empty($this->country_code))
$label.= '<br><b>' . $langs->trans('Country') . ':</b> '. $this->country_code; $label.= '<br><b>' . $langs->trans('Country') . ':</b> '. $this->country_code;

Some files were not shown because too many files have changed in this diff Show More