Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-01-27 15:00:52 +01:00
commit f714147b18
27 changed files with 274 additions and 141 deletions

View File

@ -1047,7 +1047,7 @@ if ($object->id > 0)
$sql .= " AND f.entity = ".$conf->entity; $sql .= " AND f.entity = ".$conf->entity;
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,'; $sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,'; $sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
$sql .= ' f.suspended,'; $sql .= ' f.suspended, f.date_when,';
$sql .= ' s.nom, s.rowid'; $sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.date_last_gen, f.datec DESC"; $sql .= " ORDER BY f.date_last_gen, f.datec DESC";

View File

@ -63,7 +63,7 @@ $object = new BonPrelevement($db, "");
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard')); $hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
/* /*
* Actions * Actions
@ -362,10 +362,19 @@ if ($id > 0 || $ref)
$urladd = "&id=".$id; $urladd = "&id=".$id;
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print '<form method="get" action="' . $_SERVER ['PHP_SELF'] . '" name="search_form">' . "\n";
print '<input type="hidden" name="id" value="' . $id . '"/>';
print '<input type="hidden" name="socid" value="' . $socid . '"/>';
if (! empty($page)) {
print '<input type="hidden" name="page" value="' . $page . '"/>';
}
if (! empty($limit)) {
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
}
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
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 '<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 liste" 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);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
@ -375,7 +384,7 @@ if ($id > 0 || $ref)
$total = 0; $total = 0;
while ($i < min($num, $conf->liste_limit)) while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -433,6 +442,7 @@ if ($id > 0 || $ref)
print "</table>"; print "</table>";
print '</div>'; print '</div>';
print '</form>';
$db->free($result); $db->free($result);
} }

View File

@ -196,6 +196,7 @@ else
print "</form>\n"; print "</form>\n";
print "</div>\n"; print "</div>\n";
print '</form>';
print '<br>'; print '<br>';
@ -224,6 +225,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
} }
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
@ -239,11 +245,12 @@ if ($resql)
if($socid) $param .= '&socid='.urlencode($socid); if($socid) $param .= '&socid='.urlencode($socid);
if($option) $param .= "&option=".urlencode($option); if($option) $param .= "&option=".urlencode($option);
if(! empty($page) && $num <= $nbtotalofrecords) $page = 0;
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
if (! empty($limit)) {
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
}
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);

View File

@ -43,6 +43,9 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjec
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_facture = GETPOST('search_facture', 'alpha');
$search_societe = trim(GETPOST('search_societe', 'alpha'));
// Load variable for pagination // 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');
@ -57,6 +60,26 @@ if (! $sortfield) $sortfield="f.ref";
$massactionbutton = ''; $massactionbutton = '';
$hookmanager->initHooks(array('withdrawalstodolist'));
/*
* Actions
*/
$parameters = array('socid' => $socid, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Purge search criteria
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_facture = '';
$search_societe = '';
$search_array_options = array();
}
/* /*
* View * View
@ -98,10 +121,8 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
} }
$sql.= " AND pfd.fk_facture = f.rowid"; $sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe', 'alpha')))) if ($search_facture) $sql.= natural_search("f.ref", $search_facture);
{ if ($search_societe) $sql.= natural_search("s.nom", $search_societe);
$sql.= natural_search("s.nom", 'search_societe');
}
$sql.=$db->order($sortfield, $sortorder); $sql.=$db->order($sortfield, $sortorder);
@ -140,9 +161,7 @@ else
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>'; $newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
@ -152,6 +171,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
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="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
print '<table class="liste centpercent">'; print '<table class="liste centpercent">';
@ -164,13 +184,13 @@ print_liste_field_titre('');
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag(GETPOST('search_facture', 'alpha')).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag(GETPOST('search_societe', 'alpha')).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
// Action column // Action column
print '<td class="liste_titre" class="middle">'; print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -49,7 +49,7 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check // Security check
if ($user->socid) $socid=$user->socid; if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'vat', 'charges'); $result = restrictedArea($user, 'tax', '', 'vat', 'charges');
// Get parameters // Get parameters

View File

@ -248,9 +248,17 @@ if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract).
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid; if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
$filter_dateouvertureprevue=dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear); $filter_dateouvertureprevue=dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
if ($filter_dateouvertureprevue != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = '=';
$filter_date1=dol_mktime(0, 0, 0, $op1month, $op1day, $op1year); $filter_date1=dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
if ($filter_date1 != '' && $filter_op1 == -1) $filter_op1 = '=';
$filter_date2=dol_mktime(0, 0, 0, $op2month, $op2day, $op2year); $filter_date2=dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
if ($filter_date2 != '' && $filter_op2 == -1) $filter_op2 = '=';
$filter_datecloture=dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear); $filter_datecloture=dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
if ($filter_datecloture != '' && $filter_opcloture == -1) $filter_opcloture = '=';
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'"; if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'";
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'"; if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
@ -259,6 +267,8 @@ if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
//print $sql;
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {

View File

@ -8,7 +8,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
} }
// Add extra fields // Add extra fields
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')'; $sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC';
//print $sql; //print $sql;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)

View File

@ -216,8 +216,9 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '<body id="mainbody" class="publicnewticketform">'; print '<body id="mainbody" class="publicnewticketform">';
// Define urllogo
$width = 0;
if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || ! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) { if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || ! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
print '<center>';
// Print logo // Print logo
if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO))
{ {
@ -225,21 +226,41 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/thumbs/'.$mysoc->logo_small); $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/thumbs/'.$mysoc->logo_small);
$width = 150;
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) { } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/'.$mysoc->logo); $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/'.$mysoc->logo);
$width = 128; $width = 150;
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) { } elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png'; $urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
} }
print '<a href="' . ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket/index.php', 1)) . '"><img alt="Logo" id="logosubscribe" title="" src="' . $urllogo . '" style="max-width: 440px" /></a><br>';
} }
if (! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC))
{
print '<strong>' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . '</strong>';
}
print '</center><br>';
} }
print '<div class="center">';
// Output html code for logo
if ($urllogo || ! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC))
{
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
if ($urllogo) {
print '<a href="' . ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket/index.php', 1)) . '">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '>';
print '</a>';
}
if (! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
print '<div class="clearboth"></div><strong>' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . '</strong>';
}
print '</div>';
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" width="80px"></a></div>';
}
print '</div>';
}
print '</div>';
print '<div class="ticketlargemargin">'; print '<div class="ticketlargemargin">';
} }

View File

@ -670,46 +670,47 @@ if (!empty($usemargins) && $user->rights->margins->creer)
var i = 0; var i = 0;
$(data).each(function() { $(data).each(function() {
if (this.id != 'pmpprice' && this.id != 'costprice') /* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
{ if (this.id != 'pmpprice' && this.id != 'costprice')
i++; {
this.price = parseFloat(this.price); // to fix when this.price >0 i++;
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0) this.price = parseFloat(this.price); // to fix when this.price >0
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0)); // If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0 //console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
} if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
if (this.id == 'pmpprice') }
{ if (this.id == 'pmpprice')
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0) {
//console.log("id="+this.id+"-price="+this.price); // If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice) console.log("id="+this.id+"-price="+this.price);
{ if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
if (this.price > 0) { {
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price; if (this.price > 0) {
//console.log("pmppricevalue="+pmppricevalue); defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
} //console.log("pmppricevalue="+pmppricevalue);
} }
} }
if (this.id == 'costprice') }
{ if (this.id == 'costprice')
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0) {
//console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue); // If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
if ('costprice' == defaultbuyprice) console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
{ if ('costprice' == defaultbuyprice)
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; } {
else if (pmppricevalue > 0) { defaultkey = pmppriceid; defaultprice = pmppricevalue; } if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
} else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
} }
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>'; }
}); options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>'; });
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice); console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
$("#fournprice_predef").html(options).show(); $("#fournprice_predef").html(options).show();
if (defaultkey != '') if (defaultkey != '')
{ {
$("#fournprice_predef").val(defaultkey); $("#fournprice_predef").val(defaultkey);
} }
/* At loading, no product are yet selected, so we hide field of buying_price */ /* At loading, no product are yet selected, so we hide field of buying_price */

View File

@ -1243,34 +1243,34 @@ class EmailCollector extends CommonObject
$objectid = 0; $objectid = 0;
$objectemail = null; $objectemail = null;
if ($reg[0] == 'inv') if ($reg[1] == 'inv')
{ {
$objectid = $reg[1]; $objectid = $reg[2];
$objectemail = new Facture($this->db); $objectemail = new Facture($this->db);
} }
if ($reg[0] == 'proj') if ($reg[1] == 'proj')
{ {
$objectid = $reg[1]; $objectid = $reg[2];
$objectemail = new Project($this->db); $objectemail = new Project($this->db);
} }
if ($reg[0] == 'con') if ($reg[1] == 'con')
{ {
$objectid = $reg[1]; $objectid = $reg[2];
$objectemail = new Contact($this->db); $objectemail = new Contact($this->db);
} }
if ($reg[0] == 'thi') if ($reg[1] == 'thi')
{ {
$objectid = $reg[1]; $objectid = $reg[2];
$objectemail = new Societe($this->db); $objectemail = new Societe($this->db);
} }
if ($reg[0] == 'use') if ($reg[1] == 'use')
{ {
$objectid = $reg[1]; $objectid = $reg[2];
$objectemail = new User($this->db); $objectemail = new User($this->db);
} }
if ($reg[0] == 'tic') if ($reg[1] == 'tic')
{ {
$objectid = $reg[1]; $objectid = $reg[2];
$objectemail = new Ticket($this->db); $objectemail = new Ticket($this->db);
} }

View File

@ -84,16 +84,17 @@ if ($idprod > 0)
} }
} }
// Add price for costprice // After best supplier prices and before costprice
$price=$producttmp->cost_price;
$prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price()
if(!empty($conf->stock->enabled)) if(!empty($conf->stock->enabled))
{ {
// Add price for pmp // Add price for pmp
$price=$producttmp->pmp; $price=$producttmp->pmp;
$prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price()
} }
// Add price for costprice (at end)
$price=$producttmp->cost_price;
$prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price()
} }
echo json_encode($prices); echo json_encode($prices);

View File

@ -115,6 +115,7 @@ $boxstatFromHook = '';
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts')); $langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
// Load global statistics of objects
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{ {
$object = new stdClass(); $object = new stdClass();
@ -201,7 +202,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
'contacts', 'contacts',
'members', 'members',
'products', 'products',
'services', 'services',
'proposals', 'proposals',
'orders', 'orders',
'invoices', 'invoices',
@ -212,7 +213,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
'askprice', 'askprice',
'projects', 'projects',
'expensereports', 'expensereports',
'holiday', 'holidays',
'donations' 'donations'
); );
// Dashboard Icon lines // Dashboard Icon lines
@ -348,9 +349,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
/* // Dolibarr Working Board with weather
* Dolibarr Working Board with weather
*/
if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$showweather = (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0; $showweather = (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0;
@ -701,6 +701,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n"; $openedDashBoard .= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n";
$openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n"; $openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
// Show the span for the total of record
if (!empty($groupElement['globalStats'])) { if (!empty($groupElement['globalStats'])) {
$globalStatInTopOpenedDashBoard[] = $globalStatsKey; $globalStatInTopOpenedDashBoard[] = $globalStatsKey;
$openedDashBoard .= ' <span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>'."\n"; $openedDashBoard .= ' <span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>'."\n";

View File

@ -489,6 +489,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
'MAIN_MODULE_SYSLOG'=>'newboxdefonly', 'MAIN_MODULE_SYSLOG'=>'newboxdefonly',
'MAIN_MODULE_SOCIETE'=>'newboxdefonly', 'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
'MAIN_MODULE_SERVICE'=>'newboxdefonly', 'MAIN_MODULE_SERVICE'=>'newboxdefonly',
'MAIN_MODULE_TAKEPOS'=>'newboxdefonly',
'MAIN_MODULE_USER'=>'newboxdefonly', //This one must be always done and only into last targeted version) 'MAIN_MODULE_USER'=>'newboxdefonly', //This one must be always done and only into last targeted version)
'MAIN_MODULE_VARIANTS'=>'newboxdefonly', 'MAIN_MODULE_VARIANTS'=>'newboxdefonly',
'MAIN_MODULE_WEBSITE'=>'newboxdefonly', 'MAIN_MODULE_WEBSITE'=>'newboxdefonly',
@ -4746,8 +4747,19 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo
$mod->init($reloadmode); $mod->init($reloadmode);
} }
} }
elseif ($moduletoreload == 'MAIN_MODULE_TAKEPOS') // Permission has changed into 10.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Takepos module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modTakePos.class.php';
if ($res) {
$mod = new modTakePos($db);
$mod->remove('noboxes'); // We need to remove because menu entries has changed
$mod->init($reloadmode);
}
}
else else
{ {
$reg = array();
$tmp = preg_match('/MAIN_MODULE_([a-zA-Z0-9]+)/', $moduletoreload, $reg); $tmp = preg_match('/MAIN_MODULE_([a-zA-Z0-9]+)/', $moduletoreload, $reg);
if (!empty($reg[1])) if (!empty($reg[1]))
{ {

View File

@ -164,7 +164,7 @@ class StockMovements extends DolibarrApi
* *
* @param int $product_id Id product id {@min 1} {@from body} {@required true} * @param int $product_id Id product id {@min 1} {@from body} {@required true}
* @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true} * @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true}
* @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0} {@from body} {@required true} * @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true}
* @param string $lot Lot {@from body} * @param string $lot Lot {@from body}
* @param string $movementcode Movement code {@example INV123} {@from body} * @param string $movementcode Movement code {@example INV123} {@from body}
* @param string $movementlabel Movement label {@example Inventory number 123} {@from body} * @param string $movementlabel Movement label {@example Inventory number 123} {@from body}

View File

@ -48,11 +48,11 @@ $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['ent
if (is_numeric($entity)) define("DOLENTITY", $entity); if (is_numeric($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Init vars // Init vars
$errmsg = ''; $errmsg = '';
@ -96,27 +96,45 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
global $user, $conf, $langs, $mysoc; global $user, $conf, $langs, $mysoc;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
print '<body id="mainbody" class="publicnewmemberform" style="margin-top: 10px;">';
// Print logo print '<body id="mainbody" class="publicnewmemberform">';
// Define urllogo
$width = 0;
$urllogo = DOL_URL_ROOT.'/theme/login_logo.png'; $urllogo = DOL_URL_ROOT.'/theme/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{ {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small); $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
$width = 150;
} }
elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{ {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo); $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width = 128; $width = 150;
} }
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
{ {
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.png'; $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.png';
$width = 150;
} }
print '<div class="center">';
print '<img alt="Logo" id="logosubscribe" title="" src="'.$urllogo.'" />'; print '<div class="center">';
print '</div><br>'; // Output html code for logo
if ($urllogo)
{
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '>';
print '</div>';
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" width="80px"></a></div>';
}
print '</div>';
}
print '</div>';
print '<div class="divmainbodylarge">'; print '<div class="divmainbodylarge">';
} }

View File

@ -15,9 +15,6 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* For paypal test: https://developer.paypal.com/
* For paybox test: ???
*/ */
/** /**
@ -26,8 +23,9 @@
* \brief File to offer a way to make an online signature for a particular Dolibarr entity * \brief File to offer a way to make an online signature for a particular Dolibarr entity
*/ */
define("NOLOGIN", 1); // This means this output page does not require to be logged. if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
// For MultiCompany module. // For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
@ -41,12 +39,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Load translation files
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox"));
// Security check // Security check
// No check on module enabled. Done later according to $validpaymentmethod // No check on module enabled. Done later according to $validpaymentmethod
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox")); $action = GETPOST('action', 'aZ09');
$action = GETPOST('action', 'alpha');
// Input are: // Input are:
// type ('invoice','order','contractline'), // type ('invoice','order','contractline'),
@ -55,7 +54,7 @@ $action = GETPOST('action', 'alpha');
// tag (a free text, required if type is empty) // tag (a free text, required if type is empty)
// currency (iso code) // currency (iso code)
$suffix = GETPOST("suffix", 'alpha'); $suffix = GETPOST("suffix", 'aZ09');
$source = GETPOST("source", 'alpha'); $source = GETPOST("source", 'alpha');
$ref = $REF = GETPOST("ref", 'alpha'); $ref = $REF = GETPOST("ref", 'alpha');
@ -71,9 +70,6 @@ if (!$action)
} }
$paymentmethod = '';
$validpaymentmethod = array();
@ -133,7 +129,8 @@ if (!empty($conf->global->MAIN_SIGN_CSS_URL)) $head = '<link rel="stylesheet" ty
$conf->dol_hide_topmenu = 1; $conf->dol_hide_topmenu = 1;
$conf->dol_hide_leftmenu = 1; $conf->dol_hide_leftmenu = 1;
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
// Check link validity // Check link validity
if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
@ -171,23 +168,32 @@ elseif (!empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall = $conf->global->ONL
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
// Define urllogo // Define urllogo
$urllogo = ''; $urllogo = '';
$urllogofull = '';
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{ {
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall); $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
$width = 150;
} }
elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{ {
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo); $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
$width = 96; $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
$width = 150;
} }
// Output html code for logo // Output html code for logo
if ($urllogo) if ($urllogo)
{ {
print '<tr>'; print '<div class="backgreypublicpayment">';
print '<td align="center"><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"'; print '<div class="logopublicpayment">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"'; if ($width) print ' width="'.$width.'"';
print '></td>'; print '>';
print '</tr>'."\n"; print '</div>';
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" width="80px"></a></div>';
}
print '</div>';
} }
// Output introduction text // Output introduction text
@ -209,7 +215,7 @@ print $text;
// Output payment summary form // Output payment summary form
print '<tr><td align="center">'; print '<tr><td align="center">';
print '<table with="100%" id="tablepublicpayment">'; print '<table with="100%" id="tablepublicpayment">';
print '<tr class="liste_total"><td align="left" colspan="2">'.$langs->trans("ThisIsInformationOnDocumentToSign").' :</td></tr>'."\n"; print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSign").' :</td></tr>'."\n";
$found = false; $found = false;
$error = 0; $error = 0;

View File

@ -34,8 +34,9 @@
* \brief File to offer a way to make a payment for a particular Dolibarr object * \brief File to offer a way to make a payment for a particular Dolibarr object
*/ */
define("NOLOGIN", 1); // This means this output page does not require to be logged. if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
// For MultiCompany module. // For MultiCompany module.
// Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php // Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php
@ -49,11 +50,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.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.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
// Load translation files
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data
// Security check // Security check
// No check on module enabled. Done later according to $validpaymentmethod // No check on module enabled. Done later according to $validpaymentmethod
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
// Input are: // Input are:

View File

@ -28,6 +28,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
@ -53,6 +54,7 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
/* /*
* Actions * Actions
*/ */

View File

@ -25,6 +25,7 @@
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
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)
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
// For MultiCompany module. // For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php

View File

@ -965,6 +965,7 @@ else
if (!empty($conf->fournisseur->enabled) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur = 1; } if (!empty($conf->fournisseur->enabled) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur = 1; }
$object->name = GETPOST('name', 'alpha'); $object->name = GETPOST('name', 'alpha');
$object->name_alias = GETPOST('name_alias', 'alpha');
$object->firstname = GETPOST('firstname', 'alpha'); $object->firstname = GETPOST('firstname', 'alpha');
$object->particulier = $private; $object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm', 'alpha'); $object->prefix_comm = GETPOST('prefix_comm', 'alpha');

View File

@ -569,30 +569,38 @@ if (empty($reshook))
$db->begin(); $db->begin();
if (empty($newcu)) { if (empty($newcu)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$site_account."') AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity;
} else { } else {
$sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account"; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX."societe_account";
$sql .= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'"; $sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$site_account."') AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
$sql .= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
} }
$resql = $db->query($sql); $resql = $db->query($sql);
$num = $db->num_rows($resql); $num = $db->num_rows($resql); // Note: $num is always 0 on an update and delete, it is defined for select only.
if (empty($num) && !empty($newcu)) if (!empty($newcu)) {
{ if (empty($num))
$societeaccount = new SocieteAccount($db);
$societeaccount->fk_soc = $object->id;
$societeaccount->login = '';
$societeaccount->pass_encoding = '';
$societeaccount->site = 'stripe';
$societeaccount->status = $servicestatus;
$societeaccount->key_account = $newcu;
$result = $societeaccount->create($user);
if ($result < 0)
{ {
$error++; $societeaccount = new SocieteAccount($db);
$societeaccount->fk_soc = $object->id;
$societeaccount->login = '';
$societeaccount->pass_encoding = '';
$societeaccount->site = 'stripe';
$societeaccount->status = $servicestatus;
$societeaccount->key_account = $newcu;
$societeaccount->site_account = $site_account;
$result = $societeaccount->create($user);
if ($result < 0)
{
$error++;
}
} else {
$sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account";
$sql .= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."', site_account = '".$site_account."'";
$sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$site_account."') AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
$resql = $db->query($sql);
} }
} }
//var_dump($sql); var_dump($newcu); var_dump($num); exit;
if (!$error) if (!$error)
{ {
@ -615,6 +623,8 @@ if (empty($reshook))
if (empty($newsup)) { if (empty($newsup)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity;
// TODO Add site and site_account on oauth_token table
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$site_account."') AND fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity;
} else { } else {
try { try {
$stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha'))); $stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha')));
@ -622,6 +632,8 @@ if (empty($reshook))
$tokenstring['type'] = $stripesup->type; $tokenstring['type'] = $stripesup->type;
$sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token";
$sql .= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; $sql .= " SET tokenstring = '".dol_json_encode($tokenstring)."'";
$sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$site_account."') AND fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
// TODO Add site and site_account on oauth_token table
$sql .= " WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! $sql .= " WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
} catch (Exception $e) { } catch (Exception $e) {
$error++; $error++;
@ -639,6 +651,7 @@ if (empty($reshook))
$tokenstring['type'] = $stripesup->type; $tokenstring['type'] = $stripesup->type;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)";
$sql .= " VALUES ('".$service."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')"; $sql .= " VALUES ('".$service."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')";
// TODO Add site and site_account on oauth_token table
} catch (Exception $e) { } catch (Exception $e) {
$error++; $error++;
setEventMessages($e->getMessage(), null, 'errors'); setEventMessages($e->getMessage(), null, 'errors');

View File

@ -128,7 +128,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">'; print '<input type="hidden" name="action" value="set">';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -283,7 +283,7 @@ print '</div>';
if ($conf->global->TAKEPOS_ENABLE_SUMUP) { if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
print '<br>'; print '<br>';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -138,8 +138,8 @@ if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOME
else echo $line->description;?> else echo $line->description;?>
</td> </td>
<td class="right"><?php echo $line->qty;?></td> <td class="right"><?php echo $line->qty;?></td>
<td class="right"><?php echo $line->total_ttc/$line->qty;?></td> <td class="right"><?php echo price(price2num($line->total_ttc / $line->qty, 'MT'), 1);?></td>
<td class="right"><?php echo price($line->total_ttc);?></td> <td class="right"><?php echo price($line->total_ttc, 1);?></td>
</tr> </tr>
<?php <?php
} }

View File

@ -5501,11 +5501,12 @@ div.tabsElem a.tab {
width: 70%; width: 70%;
} }
.publicnewticketform { .publicnewticketform {
margin-top: 25px !important; /* margin-top: 25px !important; */
} }
.ticketlargemargin { .ticketlargemargin {
padding-left: 50px; padding-left: 50px;
padding-right: 50px; padding-right: 50px;
padding-top: 10px;
} }
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
@ -5513,7 +5514,7 @@ div.tabsElem a.tab {
padding-left: 5px; padding-right: 5px; padding-left: 5px; padding-right: 5px;
} }
.ticketpublicarea { .ticketpublicarea {
width: 100%; width: 100% !important;
} }
} }

View File

@ -5649,11 +5649,12 @@ border-top-right-radius: 6px;
width: 70%; width: 70%;
} }
.publicnewticketform { .publicnewticketform {
margin-top: 25px !important; /* margin-top: 25px !important; */
} }
.ticketlargemargin { .ticketlargemargin {
padding-left: 50px; padding-left: 50px;
padding-right: 50px; padding-right: 50px;
padding-top: 10px;
} }
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {

View File

@ -2753,7 +2753,8 @@ class Ticket extends CommonObject
$conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
} }
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); $trackid = "tic".$this->id;
$mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
if ($mailfile->error) { if ($mailfile->error) {
setEventMessages($mailfile->error, null, 'errors'); setEventMessages($mailfile->error, null, 'errors');
} else { } else {

View File

@ -146,5 +146,9 @@ div.ticketform .blue:hover {
background-color: #f8f8f8; background-color: #f8f8f8;
} }
#form_create_ticket input.text, #form_create_ticket input.text, #form_create_ticket textarea { width:450px;}
#form_create_ticket textarea { width:450px;}
@media only screen and (max-width: 767px)
{
#form_create_ticket input.text, #form_create_ticket textarea { width: unset;}
}