Merge branch '13.0' of github.com:Dolibarr/dolibarr into develop_v13#2

This commit is contained in:
lmarcouiller 2021-05-07 09:46:37 +02:00
commit 5dcdb06e91
23 changed files with 214 additions and 113 deletions

View File

@ -542,7 +542,7 @@ $cfg['ThemePerServer'] = FALSE; // allow diferent theme for each co
* %f will be replaced by a list of field names. * %f will be replaced by a list of field names.
* (%t and %f only applies to DefaultQueryTable) * (%t and %f only applies to DefaultQueryTable)
*/ */
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1'; $cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1 = 1';
$cfg['DefaultQueryDatabase'] = ''; $cfg['DefaultQueryDatabase'] = '';
/** /**

View File

@ -812,7 +812,7 @@ while ($i < min($num, $limit)) {
print '</td>'; print '</td>';
} else { } else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($obj->subscription == 'yes') { if (!empty($obj->subscription)) {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning(); if ($obj->statut > 0) print " ".img_warning();
} else { } else {

View File

@ -477,7 +477,7 @@ if ($rowid > 0) {
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
$sql .= " AND t.rowid = ".$object->id; $sql .= " AND t.rowid = ".$object->id;
if ($sall) { if ($sall) {
$sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
} }
if ($status != '') { if ($status != '') {
$sql .= natural_search('d.statut', $status, 2); $sql .= natural_search('d.statut', $status, 2);
@ -660,7 +660,7 @@ if ($rowid > 0) {
print '</td>'; print '</td>';
} else { } else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($objp->subscription == 'yes') { if (!empty($objp->subscription)) {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->status > 0) print " ".img_warning(); if ($objp->status > 0) print " ".img_warning();
} else { } else {

View File

@ -289,14 +289,13 @@ if (empty($reshook)) {
} }
} }
// Si verif ok et action add, on ajoute la ligne // If previous test is ok action is add, we add the line
if ($ok && GETPOST('actionadd')) if ($ok && GETPOST('actionadd')) {
{
// Add new entry // Add new entry
$sql = "INSERT INTO ".$tabname[$id]." ("; $sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields // List of fields
$sql .= $tabfieldinsert[$id]; $sql .= $tabfieldinsert[$id];
$sql .= ",active)"; $sql .= ", active, enabled)";
$sql .= " VALUES("; $sql .= " VALUES(";
// List of values // List of values
@ -332,7 +331,7 @@ if (empty($reshook)) {
} }
$i++; $i++;
} }
$sql .= ", 1)"; $sql .= ", 1, 1)";
dol_syslog("actionadd", LOG_DEBUG); dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -1143,6 +1143,7 @@ if ($action == 'create')
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
$preselectedids = GETPOST('socpeopleassigned', 'array'); $preselectedids = GETPOST('socpeopleassigned', 'array');
if (GETPOST('contactid', 'int')) $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int'); if (GETPOST('contactid', 'int')) $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int');
if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int');
print img_picto('', 'contact', 'class="paddingrightonly"'); print img_picto('', 'contact', 'class="paddingrightonly"');
print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
print '</td></tr>'; print '</td></tr>';

View File

@ -1676,6 +1676,28 @@ class Account extends CommonObject
$this->owner_address = 'Owner address'; $this->owner_address = 'Owner address';
$this->country_id = 1; $this->country_id = 1;
} }
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty($db, $origin_id, $dest_id)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
if (!$db->query($sql))
{
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror();
return false;
} else {
return true;
}
}
} }

View File

@ -177,7 +177,7 @@ $sqlrequestforbankline = $sql;
if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($newbankreceipt)) if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($newbankreceipt))
{ {
// TODO Add a test to check newbankreceipt does not exists yet // TODO Add a test to check newbankreceipt does not exists yet
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX.'bank SET num_releve = "'.$db->escape($newbankreceipt).'" WHERE num_releve = "'.$db->escape($oldbankreceipt).'" AND fk_account = '.$id; $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."bank SET num_releve = '".$db->escape($newbankreceipt)."' WHERE num_releve = '".$db->escape($oldbankreceipt)."' AND fk_account = ".((int) $id);
$result = $db->query($sqlupdate); $result = $db->query($sqlupdate);
if ($result < 0) dol_print_error($db); if ($result < 0) dol_print_error($db);

View File

@ -109,36 +109,18 @@ print '<br>';
clearstatcache(); clearstatcache();
// Show link on other years // Show link on other years
$linkforyear = array(); $year_dirs = dol_dir_list($dir, 'directories', 0, '^[0-9]{4}$', '', 'DESC');
$found = 0; foreach ($year_dirs as $d)
if (is_dir($dir))
{ {
$handle = opendir($dir); print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$d['name'].'">'.$d['name'].'</a> &nbsp;';
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (is_dir($dir.'/'.$file) && !preg_match('/^\./', $file) && is_numeric($file))
{
$found = 1;
$linkforyear[] = $file;
}
}
}
}
asort($linkforyear);
foreach ($linkforyear as $cursoryear)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$cursoryear.'">'.$cursoryear.'</a> &nbsp;';
} }
$found = true;
if ($year) if ($year)
{ {
if (is_dir($dir.'/'.$year)) if (is_dir($dir.'/'.$year))
{ {
$handle = opendir($dir.'/'.$year); if (!empty($year_dirs)) print '<br>';
if ($found) print '<br>';
print '<br>'; print '<br>';
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -147,22 +129,14 @@ if ($year)
print '<td class="right">'.$langs->trans("Date").'</td>'; print '<td class="right">'.$langs->trans("Date").'</td>';
print '</tr>'; print '</tr>';
if (is_resource($handle)) $files = (dol_dir_list($dir.'/'.$year, 'files', 0, '^payments-[0-9]{4}-[0-9]{2}\.pdf$', '', 'name', 'DESC', 1));
{ foreach ($files as $f) {
while (($file = readdir($handle)) !== false) $relativepath = $f['level1name'].'/'.$f['name'];
{ print '<tr class="oddeven">';
if (preg_match('/^payment/i', $file)) print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$f['name'].'</a>'.$formfile->showPreview($f['name'], 'facture_paiement', $relativepath, 0).'</td>';
{ print '<td class="right">'.dol_print_size($f['size']).'</td>';
$tfile = $dir.'/'.$year.'/'.$file; print '<td class="right">'.dol_print_date($f['date'], "dayhour").'</td>';
$relativepath = $year.'/'.$file; print '</tr>';
print '<tr class="oddeven">';
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a>'.$formfile->showPreview($file, 'facture_paiement', $relativepath, 0).'</td>';
print '<td class="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td>';
print '</tr>';
}
}
closedir($handle);
} }
print '</table>'; print '</table>';
} }

View File

@ -68,7 +68,7 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC))
$link = GETPOST('link', 'alpha'); $link = GETPOST('link', 'alpha');
if ($link) if ($link)
{ {
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') { if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://' && substr($link, 0, 7) != 'davs://') {
$link = 'http://'.$link; $link = 'http://'.$link;
} }
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0); dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0);

View File

@ -200,7 +200,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="center"', 'td' => 'class="center"',
'text' => $objp->total_stock.' / '.$objp->seuil_stock_alerte, 'text' => price2num($objp->total_stock, 'MS').' / '.$objp->seuil_stock_alerte,
'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)), 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)),
); );

View File

@ -1277,7 +1277,10 @@ class ExtraFields
$out .= '</select>'; $out .= '</select>';
} elseif ($type == 'checkbox') } elseif ($type == 'checkbox')
{ {
$value_arr = explode(',', $value); $value_arr = $value;
if (!is_array($value)) {
$value_arr = explode(',', $value);
}
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
} elseif ($type == 'radio') } elseif ($type == 'radio')
{ {

View File

@ -1870,7 +1870,7 @@ class FormFile
print '<td class="center">'.dol_print_date($link->datea, "dayhour", "tzuser").'</td>'; print '<td class="center">'.dol_print_date($link->datea, "dayhour", "tzuser").'</td>';
print '<td class="center"></td>'; print '<td class="center"></td>';
print '<td class="right">'; print '<td class="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'" class="editfilelink editfielda reposition" >'.img_edit().'</a>'; // id= is included into $param print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'&token='.newToken().'" class="editfilelink editfielda reposition" >'.img_edit().'</a>'; // id= is included into $param
if ($permissiontodelete) { if ($permissiontodelete) {
print ' &nbsp; <a class="deletefilelink" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&linkid='.$link->id.$param.'">'.img_delete().'</a>'; // id= is included into $param print ' &nbsp; <a class="deletefilelink" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&linkid='.$link->id.$param.'">'.img_delete().'</a>'; // id= is included into $param
} else { } else {

View File

@ -833,12 +833,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
//E-mail //E-mail
't.email', 't.email',
); );
//Social media //Social media
foreach ($socialnetworks as $key => $value) { // foreach ($socialnetworks as $key => $value) {
if ($value['active']) { // if ($value['active']) {
$searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; // $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
} // }
} // }
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "t.lastname"; if (!$sortfield) $sortfield = "t.lastname";

View File

@ -8457,7 +8457,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield
if (!isset($dictvalues[$tablename])) if (!isset($dictvalues[$tablename]))
{ {
$dictvalues[$tablename] = array(); $dictvalues[$tablename] = array();
$sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields $sql = 'SELECT * FROM '.$tablename.' WHERE 1 = 1'; // Here select * is allowed as it is generic code and we don't have list of fields
if ($checkentity) $sql .= ' AND entity IN (0,'.getEntity($tablename).')'; if ($checkentity) $sql .= ' AND entity IN (0,'.getEntity($tablename).')';
$resql = $db->query($sql); $resql = $db->query($sql);
@ -8731,6 +8731,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
$class = 'butAction'; $class = 'butAction';
if ($actionType == 'danger' || $actionType == 'delete') { if ($actionType == 'danger' || $actionType == 'delete') {
$class = 'butActionDelete'; $class = 'butActionDelete';
if (strpos($url, 'token=') === false) $url .= '&token='.newToken();
} }
$attr = array( $attr = array(

View File

@ -274,6 +274,15 @@ class pdf_espadon extends ModelePdfExpedition
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0); $pdf->SetAutoPageBreak(1, 0);
// Create pdf instance
/*$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1, 0);
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
*/
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
@ -306,13 +315,13 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->AddPage(); $pdf->AddPage();
if (!empty($tplidx)) $pdf->useTemplate($tplidx); if (!empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++; $pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs); $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift: 10);
$tab_height = 130; $tab_height = 130;
$tab_height_newpage = 150; $tab_height_newpage = 150;
@ -351,62 +360,153 @@ class pdf_espadon extends ModelePdfExpedition
$notetoshow = dol_concatdesc($notetoshow, $extranote); $notetoshow = dol_concatdesc($notetoshow, $extranote);
} }
if (!empty($notetoshow) || !empty($object->tracking_number)) if (!empty($notetoshow) || !empty($object->tracking_number)) {
{ $tab_top -= 2;
$tab_top = 88 + $height_incoterms;
$tab_top_alt = $tab_top;
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
//$tab_top_alt += 1;
// Tracking number // Tracking number
if (!empty($object->tracking_number)) if (!empty($object->tracking_number)) {
{ $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
$object->getUrlTrackingStatus($object->tracking_number); $object->getUrlTrackingStatus($object->tracking_number);
if (!empty($object->tracking_url)) if (!empty($object->tracking_url)) {
{ if ($object->shipping_method_id > 0) {
if ($object->shipping_method_id > 0)
{
// Get code using getLabelFromKey // Get code using getLabelFromKey
$code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
$label = ''; $label = '';
if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage") . "<br>";
$label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); $label .= $outputlangs->trans("SendingMethod") . ": " . $outputlangs->trans("SendingMethod" . strtoupper($code));
//var_dump($object->tracking_url != $object->tracking_number);exit; //var_dump($object->tracking_url != $object->tracking_number);exit;
if ($object->tracking_url != $object->tracking_number) if ($object->tracking_url != $object->tracking_number) {
{
$label .= " : "; $label .= " : ";
$label .= $object->tracking_url; $label .= $object->tracking_url;
} }
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L'); $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY(); $tab_top = $pdf->GetY();
} }
} }
} }
// Notes // Notes
$pagenb = $pdf->getPage();
if (!empty($notetoshow)) if (!empty($notetoshow))
{ {
$pdf->SetFont('', '', $default_font_size - 1); // In loop to manage multi-page $tab_top -= 2;
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top_alt, dol_htmlentitiesbr($notetoshow), 0, 1);
$tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
$pageposbeforenote = $pagenb;
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
$pdf->startTransaction();
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
// Description
$pageposafternote = $pdf->getPage();
$posyafter = $pdf->GetY();
if ($pageposafternote > $pageposbeforenote)
{
$pdf->rollbackTransaction(true);
// prepare pages to receive notes
while ($pagenb < $pageposafternote) {
$pdf->AddPage();
$pagenb++;
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
// $this->_pagefoot($pdf,$object,$outputlangs,1);
$pdf->setTopMargin($tab_top_newpage);
// The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
}
// back to start
$pdf->setPage($pageposbeforenote);
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
$pageposafternote = $pdf->getPage();
$posyafter = $pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) // There is no space left for total+free text
{
$pdf->AddPage('', '', true);
$pagenb++;
$pageposafternote++;
$pdf->setPage($pageposafternote);
$pdf->setTopMargin($tab_top_newpage);
// The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
//$posyafter = $tab_top_newpage;
}
// apply note frame to previous pages
$i = $pageposbeforenote;
while ($i < $pageposafternote) {
$pdf->setPage($i);
$pdf->SetDrawColor(128, 128, 128);
// Draw note frame
if ($i > $pageposbeforenote) {
$height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
} else {
$height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
$pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
}
// Add footer
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$i++;
}
// apply note frame to last page
$pdf->setPage($pageposafternote);
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$height_note = $posyafter - $tab_top_newpage;
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
} else // No pagebreak
{
$pdf->commitTransaction();
$posyafter = $pdf->GetY();
$height_note = $posyafter - $tab_top;
$pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20)))
{
// not enough space, need to add page
$pdf->AddPage('', '', true);
$pagenb++;
$pageposafternote++;
$pdf->setPage($pageposafternote);
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$posyafter = $tab_top_newpage;
}
}
$tab_height = $tab_height - $height_note;
$tab_top = $posyafter + 6;
} else {
$height_note = 0;
} }
$nexY = $pdf->GetY();
$height_note = $nexY - $tab_top;
// Rect takes a length in 3rd parameter
$pdf->SetDrawColor(192, 192, 192);
$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY + 6;
} else {
$height_note = 0;
} }
@ -415,13 +515,15 @@ class pdf_espadon extends ModelePdfExpedition
// Table simulation to know the height of the title line // Table simulation to know the height of the title line
$pdf->startTransaction(); $pdf->startTransaction();
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs);
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$nexY = $tab_top + $this->tabTitleHeight; $nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines // Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
$pagenb = $pageposbeforeprintlines;
for ($i = 0; $i < $nblines; $i++) for ($i = 0; $i < $nblines; $i++)
{ {
$curY = $nexY; $curY = $nexY;
@ -590,7 +692,7 @@ class pdf_espadon extends ModelePdfExpedition
while ($pagenb < $pageposafter) while ($pagenb < $pageposafter)
{ {
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
if ($pagenb == 1) if ($pagenb == $pageposbeforeprintlines)
{ {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
} else { } else {

View File

@ -218,12 +218,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product); $objphoto->fetch($object->lines[$i]->fk_product);
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
{ $pdir = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
} else { } else {
$pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $pdir = get_exdir($objphoto->id, 0, 0, 0, $objphoto, 'product');
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
} }

View File

@ -233,15 +233,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product); $objphoto->fetch($object->lines[$i]->fk_product);
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
{ $pdir = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
} else { } else {
$pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $pdir = get_exdir($objphoto->id, 0, 0, 0, $objphoto, 'product');
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
} }
$realpath = ''; $realpath = '';
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
{ {

View File

@ -583,4 +583,5 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL; -- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL;
-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL;
ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64);

View File

@ -24,7 +24,7 @@ create table llx_export_model
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer DEFAULT 0 NOT NULL, fk_user integer DEFAULT 0 NOT NULL,
label varchar(50) NOT NULL, label varchar(50) NOT NULL,
type varchar(20) NOT NULL, type varchar(64) NOT NULL,
field text NOT NULL, field text NOT NULL,
filter text filter text

View File

@ -254,7 +254,8 @@ if (empty($reshook))
'Product' => '/product/class/product.class.php', 'Product' => '/product/class/product.class.php',
'Project' => '/projet/class/project.class.php', 'Project' => '/projet/class/project.class.php',
'Ticket' => '/ticket/class/ticket.class.php', 'Ticket' => '/ticket/class/ticket.class.php',
'User' => '/user/class/user.class.php' 'User' => '/user/class/user.class.php',
'Account' => '/compta/bank/class/account.class.php',
); );
//First, all core objects must update their tables //First, all core objects must update their tables

View File

@ -318,7 +318,7 @@ if (!empty($sql_select))
if ($sref) $sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; if ($sref) $sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
if ($sprod_fulldescr) if ($sprod_fulldescr)
{ {
$sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; $sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%' OR d.description LIKE '%".$db->escape(dol_htmlentities($sprod_fulldescr))."%'";
if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'";
if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'";
$sql .= ")"; $sql .= ")";

View File

@ -329,7 +329,7 @@ if ($id > 0 || !empty($ref))
print '</td>'; print '</td>';
} else { } else {
print '<td class="left nowrap">'; print '<td class="left nowrap">';
if ($objp->subscription == 'yes') if (!empty($objp->subscription))
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($objp->statut > 0) print " ".img_warning();

View File

@ -3425,7 +3425,7 @@ class User extends CommonObject
$sql .= " WHERE t.entity IN (".getEntity('user').")"; $sql .= " WHERE t.entity IN (".getEntity('user').")";
} }
} else { } else {
$sql .= " WHERE 1"; $sql .= " WHERE 1 = 1";
} }
// Manage filter // Manage filter