mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -246,11 +246,14 @@ if ($reshook == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
$permissiontoadd = 1;
|
||||
|
||||
//asort($elementList);
|
||||
|
||||
$id = 25;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@@ -338,6 +341,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
$action = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,6 +415,7 @@ if (empty($reshook)) {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,6 +494,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,7 +521,7 @@ if (empty($reshook)) {
|
||||
if ($action == $acts[0]) {
|
||||
$rowidcol = "rowid";
|
||||
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."=".((int) $rowid);
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
@@ -527,7 +533,7 @@ if (empty($reshook)) {
|
||||
if ($action == $acts[1]) {
|
||||
$rowidcol = "rowid";
|
||||
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."=".((int) $rowid);
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
@@ -545,18 +551,38 @@ $form = new Form($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
} else {
|
||||
$title = $langs->trans("EMailsTemplates");
|
||||
}
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
print load_fiche_titre($title, $linkback, $titlepicto);
|
||||
|
||||
$head = email_admin_prepare_head();
|
||||
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
||||
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre($title, '', $titlepicto);
|
||||
} else {
|
||||
print load_fiche_titre($title, $newcardbutton, $titlepicto);
|
||||
}
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$head = email_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'templates', '', -1);
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre('', $newcardbutton, '');
|
||||
}
|
||||
}
|
||||
|
||||
print dol_get_fiche_head($head, 'templates', '', -1);
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete') {
|
||||
@@ -599,7 +625,7 @@ $sql .= $db->plimit($listlimit + 1, $offset);
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
if ($action == 'view') {
|
||||
if ($action == 'add') {
|
||||
// Form to add a new line
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@@ -750,7 +776,8 @@ if ($action == 'view') {
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
|
||||
if ($action != 'edit') {
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"><br>';
|
||||
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@@ -1142,7 +1169,10 @@ print '</div>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@@ -310,6 +310,8 @@ if ($object->fetch($id) >= 0) {
|
||||
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
|
||||
|
||||
//print '<table class="noborder centpercent">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">';
|
||||
|
||||
//print '<tr class="liste_titre">';
|
||||
@@ -323,7 +325,7 @@ if ($object->fetch($id) >= 0) {
|
||||
//print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<div class="tagtd"> </div>';
|
||||
//print "</tr>\n";
|
||||
print '</div>';
|
||||
print '</div>'; // End tr
|
||||
|
||||
clearstatcache();
|
||||
|
||||
@@ -424,9 +426,9 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
print '<div class="tagtd right">';
|
||||
if ($allowaddtarget) {
|
||||
print '<input type="submit" class="button button-add" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add small" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
} else {
|
||||
print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
//print $langs->trans("MailNoChangePossible");
|
||||
print " ";
|
||||
}
|
||||
@@ -445,6 +447,7 @@ if ($object->fetch($id) >= 0) {
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</div>'; // End table
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
@@ -535,7 +538,7 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
$morehtmlcenter = '';
|
||||
if ($allowaddtarget) {
|
||||
$morehtmlcenter = '<span class="opacitymedium">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
|
||||
$morehtmlcenter = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
|
||||
}
|
||||
$morehtmlcenter .= ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?exportcsv=1&id='.$object->id.'">'.$langs->trans("Download").'</a>';
|
||||
|
||||
|
||||
@@ -43,9 +43,8 @@ if (isset($user->socid) && $user->socid > 0) {
|
||||
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
// Maximum elements of the tables
|
||||
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
$maxLatestEditCount = 5;
|
||||
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
|
||||
|
||||
/*
|
||||
@@ -64,7 +63,7 @@ if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
}
|
||||
$tmp = getCustomerInvoiceDraftTable($max, $socid);
|
||||
$tmp = getCustomerInvoiceDraftTable($maxDraftCount, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
@@ -74,13 +73,13 @@ print '</div>';
|
||||
|
||||
print '<div class="fichetwothirdright">';
|
||||
|
||||
$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
|
||||
$tmp = getCustomerInvoiceLatestEditTable($max, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$tmp = getCustomerInvoiceUnpaidOpenTable($max, $socid);
|
||||
$tmp = getCustomerInvoiceUnpaidOpenTable($maxOpenCount, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
|
||||
@@ -575,7 +575,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
|
||||
@@ -800,7 +800,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
|
||||
@@ -749,9 +749,9 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@@ -887,9 +887,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
||||
|
||||
@@ -138,9 +138,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ORDER BY sp.poste";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= $langs->trans("PostOrFunction").' ';
|
||||
$s .= '<select name="filter_jobposition" class="flat marginrightonly" placeholder="'.dol_escape_htmltag($langs->trans("PostOrFunction")).'">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_jobposition_contact" name="filter_jobposition" class="flat" placeholder="'.dol_escape_htmltag($langs->trans("PostOrFunction")).'">';
|
||||
$s .= '<option value="-1">'.$langs->trans("PostOrFunction").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
@@ -157,11 +156,10 @@ class mailing_contacts1 extends MailingTargets
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
|
||||
$s .= ajax_combobox("filter_jobposition_contact");
|
||||
$s .= ' ';
|
||||
|
||||
// Filter on contact category
|
||||
$s .= $langs->trans("ContactCategoriesShort").' ';
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
@@ -176,8 +174,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ORDER BY c.label";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= '<select name="filter_category" class="flat marginrightonly">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_category_contact" name="filter_category" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("ContactCategoriesShort").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
@@ -194,12 +192,11 @@ class mailing_contacts1 extends MailingTargets
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
|
||||
$s .= ajax_combobox("filter_category_contact");
|
||||
$s .= '<br>';
|
||||
|
||||
// Add prospect of a particular level
|
||||
$s .= $langs->trans("NatureOfThirdParty").' ';
|
||||
$s .= '<select name="filter" class="flat marginrightonly">';
|
||||
$s .= '<select id="filter_contact" name="filter" class="flat">';
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
@@ -208,9 +205,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("NatureOfThirdParty").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="all">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
}
|
||||
$s .= '<option value="prospects">'.$langs->trans("ThirdPartyProspects").'</option>';
|
||||
|
||||
@@ -231,11 +228,11 @@ class mailing_contacts1 extends MailingTargets
|
||||
//$s.='<option value="customersidprof">'.$langs->trans("ThirdPartyCustomersWithIdProf12",$langs->trans("ProfId1"),$langs->trans("ProfId2")).'</option>';
|
||||
$s .= '<option value="suppliers">'.$langs->trans("ThirdPartySuppliers").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_contact");
|
||||
|
||||
$s .= ' ';
|
||||
|
||||
// Filter on thirdparty category
|
||||
$s .= $langs->trans("CustomersProspectsCategoriesShort").' ';
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
@@ -250,8 +247,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ORDER BY c.label";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= '<select name="filter_category_customer" class="flat marginrightonly maxwidth200">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_category_customer_contact" name="filter_category_customer" class="flat maxwidth200">';
|
||||
$s .= '<option value="-1">'.$langs->trans("CustomersProspectsCategoriesShort").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
@@ -268,11 +265,11 @@ class mailing_contacts1 extends MailingTargets
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_category_customer_contact");
|
||||
|
||||
$s .= ' ';
|
||||
|
||||
// Filter on thirdparty category
|
||||
$s .= $langs->trans("SuppliersCategoriesShort").' ';
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
@@ -287,8 +284,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ORDER BY c.label";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= '<select name="filter_category_supplier" class="flat marginrightonly maxwidth200">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_category_supplier_contact" name="filter_category_supplier" class="flat maxwidth200">';
|
||||
$s .= '<option value="-1">'.$langs->trans("SuppliersCategoriesShort").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
@@ -305,7 +302,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
|
||||
$s .= ajax_combobox("filter_category_supplier_contact");
|
||||
return $s;
|
||||
}
|
||||
|
||||
@@ -366,22 +363,16 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " s.nom as companyname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
if ($filter_category <> 'all') {
|
||||
if ($filter_category != 'all' && $filter_category != '-1') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||
}
|
||||
if ($filter_category <> 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_contact as cs";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
if ($filter_category_customer != 'all' && $filter_category_customer != '-1') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c2";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c2s";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
if ($filter_category_supplier != 'all' && $filter_category_supplier != '-1') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c3";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
|
||||
}
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
@@ -391,34 +382,28 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
// Filter on category
|
||||
if ($filter_category <> 'all') {
|
||||
if ($filter_category != 'all' && $filter_category != '-1') {
|
||||
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_socpeople = sp.rowid";
|
||||
}
|
||||
if ($filter_category <> 'all') {
|
||||
$sql .= " AND c.label = '".$this->db->escape($filter_category)."'";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
if ($filter_category_customer != 'all' && $filter_category_customer != '-1') {
|
||||
$sql .= " AND c2s.fk_categorie = c2.rowid AND c2s.fk_soc = sp.fk_soc";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
$sql .= " AND c2.label = '".$this->db->escape($filter_category_customer)."'";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
if ($filter_category_supplier != 'all' && $filter_category_supplier != '-1') {
|
||||
$sql .= " AND c3s.fk_categorie = c3.rowid AND c3s.fk_soc = sp.fk_soc";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
$sql .= " AND c3.label = '".$this->db->escape($filter_category_supplier)."'";
|
||||
}
|
||||
// Filter on nature
|
||||
$key = $filter;
|
||||
{
|
||||
//print "xx".$key;
|
||||
|
||||
//print "xx".$key;
|
||||
if ($key == 'prospects') {
|
||||
$sql .= " AND s.client=2";
|
||||
}
|
||||
foreach ($prospectlevel as $codelevel => $valuelevel) {
|
||||
if ($key == 'prospectslevel'.$codelevel) {
|
||||
$sql .= " AND s.fk_prospectlevel='".$this->db->escape($codelevel)."'";
|
||||
$sql .= " AND s.fk_prospectlevel = '".$this->db->escape($codelevel)."'";
|
||||
}
|
||||
}
|
||||
if ($key == 'customers') {
|
||||
@@ -427,17 +412,18 @@ class mailing_contacts1 extends MailingTargets
|
||||
if ($key == 'suppliers') {
|
||||
$sql .= " AND s.fournisseur=1";
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on job position
|
||||
$key = $filter_jobposition;
|
||||
if (!empty($key) && $key != 'all') {
|
||||
$sql .= " AND sp.poste ='".$this->db->escape($key)."'";
|
||||
$key = $filter_jobposition;
|
||||
if (!empty($key) && $key != 'all' && $key != '-1') {
|
||||
$sql .= " AND sp.poste = '".$this->db->escape($key)."'";
|
||||
}
|
||||
$sql .= " ORDER BY sp.email";
|
||||
|
||||
$sql .= " ORDER BY sp.email";
|
||||
//print "wwwwwwx".$sql;
|
||||
|
||||
// Stocke destinataires dans cibles
|
||||
$result = $this->db->query($sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
@@ -123,16 +123,16 @@ class mailing_fraise extends MailingTargets
|
||||
$s = '';
|
||||
|
||||
// Status
|
||||
$s .= $langs->trans("Status").': ';
|
||||
$s .= '<select name="filter" class="flat">';
|
||||
$s .= '<option value="none"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("MemberStatusDraft").'</option>';
|
||||
$s .= '<select id="filter_fraise" name="filter" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="draft">'.$langs->trans("MemberStatusDraft").'</option>';
|
||||
$s .= '<option value="1a">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusPaidShort").')</option>';
|
||||
$s .= '<option value="1b">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusActiveLateShort").')</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
||||
$s .= '</select> ';
|
||||
$s .= $langs->trans("Type").': ';
|
||||
$s .= '<select name="filter_type" class="flat">';
|
||||
$s .= ajax_combobox("filter_fraise");
|
||||
|
||||
$s .= '<select id="filter_type_fraise" name="filter_type" class="flat">';
|
||||
$sql = "SELECT rowid, libelle as label, statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
@@ -141,7 +141,7 @@ class mailing_fraise extends MailingTargets
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("Type").'</option>';
|
||||
if (!$num) {
|
||||
$s .= '<option value="0" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
}
|
||||
@@ -154,16 +154,17 @@ class mailing_fraise extends MailingTargets
|
||||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_type");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_type_fraise");
|
||||
|
||||
$s .= ' ';
|
||||
|
||||
$s .= $langs->trans("Category").': ';
|
||||
$s .= '<select name="filter_category" class="flat">';
|
||||
$s .= '<select id="filter_category_fraise" name="filter_category" class="flat">';
|
||||
|
||||
// Show categories
|
||||
$sql = "SELECT rowid, label, type, visible";
|
||||
@@ -178,7 +179,7 @@ class mailing_fraise extends MailingTargets
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("Category").'</option>';
|
||||
if (!$num) {
|
||||
$s .= '<option value="0" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
}
|
||||
@@ -191,6 +192,7 @@ class mailing_fraise extends MailingTargets
|
||||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_category_fraise");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@@ -246,7 +248,7 @@ class mailing_fraise extends MailingTargets
|
||||
$sql .= " a.lastname, a.firstname,";
|
||||
$sql .= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
if (GETPOST('filter_category')) {
|
||||
if (GETPOST('filter_category', 'int') > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie AND c.rowid = ".((int) GETPOST('filter_category', 'int'));
|
||||
}
|
||||
@@ -254,16 +256,13 @@ class mailing_fraise extends MailingTargets
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
// Filter on status
|
||||
if (GETPOST("filter") == '-1') {
|
||||
$sql .= " AND a.statut=-1";
|
||||
}
|
||||
if (GETPOST("filter", 'aZ09') == '1a') {
|
||||
if (GETPOST("filter", 'aZ09') == 'draft') {
|
||||
$sql .= " AND a.statut = -1";
|
||||
} elseif (GETPOST("filter", 'aZ09') == '1a') {
|
||||
$sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
}
|
||||
if (GETPOST("filter", 'aZ09') == '1b') {
|
||||
} elseif (GETPOST("filter", 'aZ09') == '1b') {
|
||||
$sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
}
|
||||
if (GETPOST("filter", 'aZ09') === '0') {
|
||||
} elseif (GETPOST("filter", 'aZ09') === '0') {
|
||||
$sql .= " AND a.statut=0";
|
||||
}
|
||||
// Filter on date
|
||||
@@ -276,7 +275,7 @@ class mailing_fraise extends MailingTargets
|
||||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
// Filter on type
|
||||
if (GETPOST('filter_type', 'int') > 0) {
|
||||
$sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type', 'int'))."'";
|
||||
$sql .= " AND ta.rowid = ".((int) GETPOST('filter_type', 'int'));
|
||||
}
|
||||
$sql .= " ORDER BY a.email";
|
||||
//print $sql;
|
||||
|
||||
264
htdocs/core/modules/mailings/partnership.modules.php
Normal file
264
htdocs/core/modules/mailings/partnership.modules.php
Normal file
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This file is an example to follow to add your own email selector inside
|
||||
* the Dolibarr email tool.
|
||||
* Follow instructions given in README file to know what to change to build
|
||||
* your own emailing list selector.
|
||||
* Code that need to be changed in this file are marked by "CHANGE THIS" tag.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mailings/partnership.modules.php
|
||||
* \ingroup mailing
|
||||
* \brief Example file to provide a list of recipients for mailing module
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage a list of personalised recipients for mailing feature
|
||||
*/
|
||||
class mailing_partnership extends MailingTargets
|
||||
{
|
||||
public $name = 'PartnershipThirdartiesOrMembers';
|
||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
||||
public $desc = "Thirdparties or members included into a partnership program";
|
||||
public $require_admin = 0;
|
||||
|
||||
public $require_module = array(); // This module allows to select by categories must be also enabled if category module is not activated
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'partnership';
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load("companies");
|
||||
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* This is the main function that returns the array of emails
|
||||
*
|
||||
* @param int $mailing_id Id of mailing. No need to use it.
|
||||
* @return int <0 if error, number of emails added if ok
|
||||
*/
|
||||
public function add_to_target($mailing_id)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$cibles = array();
|
||||
$addDescription = '';
|
||||
|
||||
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, pt.label as label, 'thirdparty' as source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND pt.rowid = p.fk_type";
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
|
||||
$sql .= " UNION ";
|
||||
|
||||
$sql .= "SELECT s.rowid as id, s.email as email, s.lastname as name, null as fk_contact, s.firstname as firstname, pt.label as label, 'member' as source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('member').")";
|
||||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND p.fk_member = s.rowid";
|
||||
$sql .= " AND pt.rowid = p.fk_type";
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY email";
|
||||
|
||||
// Stock recipients emails into targets table
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
|
||||
|
||||
$old = '';
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($old <> $obj->email) {
|
||||
$otherTxt = ($obj->label ? $langs->transnoentities("PartnershipType").'='.$obj->label : '');
|
||||
if (strlen($addDescription) > 0 && strlen($otherTxt) > 0) {
|
||||
$otherTxt .= ";";
|
||||
}
|
||||
$otherTxt .= $addDescription;
|
||||
$cibles[$j] = array(
|
||||
'email' => $obj->email,
|
||||
'fk_contact' => $obj->fk_contact,
|
||||
'lastname' => $obj->name, // For a thirdparty, we must use name
|
||||
'firstname' => '', // For a thirdparty, lastname is ''
|
||||
'other' => $otherTxt,
|
||||
'source_url' => $this->url($obj->id, $obj->source),
|
||||
'source_id' => $obj->id,
|
||||
'source_type' => $obj->source
|
||||
);
|
||||
$old = $obj->email;
|
||||
$j++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_syslog($this->db->error());
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return parent::addTargetsToDatabase($mailing_id, $cibles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On the main mailing area, there is a box with statistics.
|
||||
* If you want to add a line in this report you must provide an
|
||||
* array of SQL request that returns two field:
|
||||
* One called "label", One called "nb".
|
||||
*
|
||||
* @return array Array with SQL requests
|
||||
*/
|
||||
public function getSqlArrayForStats()
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
//var $statssql=array();
|
||||
//$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL";
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return here number of distinct emails returned by your selector.
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int Nb of recipients
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(distinct(s.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.rowid = p.fk_soc AND s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
$sql .= " UNION ";
|
||||
|
||||
$sql .= "SELECT count(distinct(s.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."adherent as s";
|
||||
$sql .= " WHERE s.rowid = p.fk_member AND s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('member').")";
|
||||
|
||||
//print $sql;
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is to add a form filter to provide variant of selector
|
||||
* If used, the HTML select must be called "filter"
|
||||
*
|
||||
* @return string A html select zone
|
||||
*/
|
||||
public function formFilter()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
$s = '<select id="filter_partnership" name="filter" class="flat">';
|
||||
|
||||
// Show categories
|
||||
$sql = "SELECT rowid, label, code, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_partnership_type";
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY label";
|
||||
|
||||
//print $sql;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
if (empty($conf->partnership->enabled)) {
|
||||
$num = 0; // Force empty list if category module is not enabled
|
||||
}
|
||||
|
||||
if ($num) {
|
||||
$s .= '<option value="-1">'.$langs->trans("PartnershipType").'</option>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$s .= '<option value="'.$obj->rowid.'">'.dol_escape_htmltag($obj->label);
|
||||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_partnership");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$s .= '</select> ';
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can include an URL link on each record provided by selector shown on target page.
|
||||
*
|
||||
* @param int $id ID
|
||||
* @param string $sourcetype Source type
|
||||
* @return string Url link
|
||||
*/
|
||||
public function url($id, $sourcetype = 'thirdparty')
|
||||
{
|
||||
if ($sourcetype == 'thirparty') {
|
||||
return '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $id).'">'.img_object('', "societe").'</a>';
|
||||
}
|
||||
if ($sourcetype == 'member') {
|
||||
return '<a href="'.DOL_URL_ROOT.'/adherent/card.php?id='.((int) $id).'">'.img_object('', "member").'</a>';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -119,20 +119,20 @@ class mailing_pomme extends MailingTargets
|
||||
$langs->load("users");
|
||||
|
||||
$s = '';
|
||||
$s .= $langs->trans("Status").' ';
|
||||
$s .= '<select name="filter" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
$s .= '<select id="filter_pomme"" name="filter" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_pomme");
|
||||
|
||||
$s .= ' ';
|
||||
$s .= $langs->trans("Employee").' ';
|
||||
$s .= '<select name="filteremployee" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
$s .= '<select id="filteremployee_pomme" name="filteremployee" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Employee").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Yes").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("No").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filteremployee_pomme");
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,9 @@ class mailing_thirdparties extends MailingTargets
|
||||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND cs.fk_soc = s.rowid";
|
||||
$sql .= " AND c.rowid = cs.fk_categorie";
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
$sql .= $addFilter;
|
||||
$sql .= " UNION ";
|
||||
$sql .= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
|
||||
@@ -125,7 +127,9 @@ class mailing_thirdparties extends MailingTargets
|
||||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND cs.fk_soc = s.rowid";
|
||||
$sql .= " AND c.rowid = cs.fk_categorie";
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
$sql .= $addFilter;
|
||||
}
|
||||
$sql .= " ORDER BY email";
|
||||
@@ -206,7 +210,7 @@ class mailing_thirdparties extends MailingTargets
|
||||
|
||||
$sql = "SELECT count(distinct(s.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.email != ''";
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
@@ -226,8 +230,7 @@ class mailing_thirdparties extends MailingTargets
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
$s = $langs->trans("Categories").' ';
|
||||
$s .= '<select name="filter" class="flat marginrightonly">';
|
||||
$s = '<select id="filter_thirdparties" name="filter" class="flat">';
|
||||
|
||||
// Show categories
|
||||
$sql = "SELECT rowid, label, type, visible";
|
||||
@@ -247,7 +250,7 @@ class mailing_thirdparties extends MailingTargets
|
||||
}
|
||||
|
||||
if ($num) {
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("Categories").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
}
|
||||
@@ -270,14 +273,15 @@ class mailing_thirdparties extends MailingTargets
|
||||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_thirdparties");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$s .= '</select> ';
|
||||
$s .= $langs->trans('ProspectCustomer');
|
||||
$s .= ' <select name="filter_client" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
|
||||
$s .= '<select id="filter_client_thirdparties" name="filter_client_thirdparties" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans('ProspectCustomer').'</option>';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
||||
$s .= '<option value="2">'.$langs->trans('Prospect').'</option>';
|
||||
}
|
||||
@@ -290,13 +294,14 @@ class mailing_thirdparties extends MailingTargets
|
||||
$s .= '<option value="0">'.$langs->trans('NorProspectNorCustomer').'</option>';
|
||||
|
||||
$s .= '</select> ';
|
||||
$s .= ajax_combobox("filter_client_thirdparties");
|
||||
|
||||
$s .= $langs->trans("Status");
|
||||
$s .= ' <select name="filter_status" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
$s .= '<option value="1" selected>'.$langs->trans("Enabled").'</option>';
|
||||
$s .= ' <select id="filter_status_thirdparties" name="filter_status" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_status_thirdparties");
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,10 +215,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$s = $langs->trans("ProductOrService");
|
||||
$s .= '<select name="filter" class="flat">';
|
||||
$s .= '<select id="filter_services_expired" name="filter" class="flat">';
|
||||
if (count($this->arrayofproducts)) {
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("ProductOrService").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
}
|
||||
@@ -226,6 +225,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
$s .= '<option value="'.$key.'">'.$val.'</option>';
|
||||
}
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_services_expired");
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@@ -810,7 +810,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
||||
@@ -746,7 +746,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@@ -625,7 +625,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@@ -619,7 +619,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@@ -27,9 +27,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
|
||||
// Security check
|
||||
restrictedArea($user, 'fournisseur', 0, '', 'facture');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(['bills', 'boxes']);
|
||||
|
||||
@@ -47,9 +44,21 @@ $maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->glob
|
||||
$maxLatestEditCount = 5;
|
||||
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
|
||||
// Security check
|
||||
restrictedArea($user, 'fournisseur', 0, '', 'facture');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("", $langs->trans("SupplierInvoicesArea"), 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
|
||||
|
||||
@@ -64,7 +73,7 @@ if ($tmp) {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$tmp = getDraftSupplierTable($maxDraftCount, $socid);
|
||||
$tmp = getDraftSupplierTable($max, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
|
||||
@@ -106,7 +106,7 @@ class Partnership extends CommonObject
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
|
||||
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
|
||||
'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 20),
|
||||
'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'notnull'=>1, 'enabled' => 1, 'visible' => 1, 'position' => 20),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
||||
@@ -245,6 +245,11 @@ class Partnership extends CommonObject
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
if ($this->fk_soc <= 0 && $this->fk_member <= 0) {
|
||||
$this->error[] = "ErrorThirpdartyOrMemberidIsManadatory";
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->status = 0;
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
@@ -547,6 +552,11 @@ class Partnership extends CommonObject
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
if ($this->fk_soc <= 0 && $this->fk_member <= 0) {
|
||||
$this->error[] = "ErrorThirpdartyOrMemberidIsManadatory";
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user