Debug v16

This commit is contained in:
Laurent Destailleur 2022-05-19 13:08:00 +02:00
parent 672a646fa9
commit 4b996f79a9
15 changed files with 172 additions and 159 deletions

View File

@ -43,17 +43,6 @@ if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet'; $in_bookkeeping = 'notyet';
} }
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
// Get information of journal // Get information of journal
$object = new AccountingJournal($db); $object = new AccountingJournal($db);
$result = $object->fetch($id_journal); $result = $object->fetch($id_journal);
@ -65,7 +54,7 @@ if ($result > 0) {
accessforbidden($langs->trans('ErrorRecordNotFound')); accessforbidden($langs->trans('ErrorRecordNotFound'));
} }
$hookmanager->initHooks(array('globaljournal', $object->nature_text . 'journal')); $hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
$parameters = array(); $parameters = array();
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@ -93,6 +82,18 @@ if (!is_array($journal_data)) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
/* /*
* Actions * Actions
*/ */

View File

@ -961,7 +961,7 @@ if ($action == 'create') {
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) { if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
print "\n\n<div class=\"tabsAction\">\n"; print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) { if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
} }
@ -1066,7 +1066,7 @@ if ($action == 'create') {
print dol_get_fiche_end(); print dol_get_fiche_end();
print dol_set_focus('#sendto'); dol_set_focus('#sendto');
} }

View File

@ -86,6 +86,11 @@ class Mailing extends CommonObject
*/ */
public $email_from; public $email_from;
/**
* @var string email to
*/
public $sendto;
/** /**
* @var string email reply to * @var string email reply to
*/ */
@ -175,6 +180,11 @@ class Mailing extends CommonObject
*/ */
public $statuts = array(); public $statuts = array();
/**
* @var array substitutionarray
*/
public $substitutionarray;
/** /**
* Constructor * Constructor

View File

@ -181,6 +181,12 @@ class Contact extends CommonObject
*/ */
public $email; public $email;
/**
* URL
* @var string
*/
public $url;
/** /**
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings * Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
* @var int * @var int
@ -315,6 +321,7 @@ class Contact extends CommonObject
*/ */
public $stcomm_picto; public $stcomm_picto;
/** /**
* Constructor * Constructor
* *

View File

@ -93,12 +93,17 @@ abstract class CommonInvoice extends CommonObject
const STATUS_ABANDONED = 3; const STATUS_ABANDONED = 3;
public $totalpaid; // duplicate with sumpayed
public $totaldeposits; // duplicate with sumdeposit
public $totalcreditnotes; // duplicate with sumcreditnote
public $sumpayed; public $sumpayed;
public $sumpayed_multicurrency; public $sumpayed_multicurrency;
public $sumdeposit; public $sumdeposit;
public $sumdeposit_multicurrency; public $sumdeposit_multicurrency;
public $sumcreditnote; public $sumcreditnote;
public $sumcreditnote_multicurrency; public $sumcreditnote_multicurrency;
public $remaintopay;
/** /**

View File

@ -115,6 +115,11 @@ abstract class CommonObject
*/ */
public $array_languages = null; // Value is array() when load already tried public $array_languages = null; // Value is array() when load already tried
/**
* @var array To sotre result of ->liste_contact()
*/
public $contacts_ids;
/** /**
* @var mixed Array of linked objects, set and used when calling ->create() to be able to create links during the creation of object * @var mixed Array of linked objects, set and used when calling ->create() to be able to create links during the creation of object
*/ */

View File

@ -917,44 +917,46 @@ class dolReceiptPrinter extends Printer
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$obj = $this->db->fetch_array($resql); $obj = $this->db->fetch_array($resql);
if (empty($obj)) {
$error++;
$this->errors[] = 'PrinterDontExist';
}
if (!$error) {
$parameter = (isset($obj['parameter']) ? $obj['parameter'] : '');
try {
$type = $obj['fk_type'];
switch ($type) {
case 1:
$this->connector = new DummyPrintConnector();
break;
case 2:
$this->connector = new FilePrintConnector($parameter);
break;
case 3:
$parameters = explode(':', $parameter);
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
break;
case 4: // LPT1, smb://...
$this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
break;
case 5:
$this->connector = new CupsPrintConnector($parameter);
break;
default:
$this->connector = 'CONNECTOR_UNKNOWN';
break;
}
$this->printer = new Printer($this->connector, $this->profile);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
$error++;
}
}
} else { } else {
$error++; $error++;
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
} }
if (empty($obj)) {
$error++;
$this->errors[] = 'PrinterDontExist';
}
if (!$error) {
$parameter = $obj['parameter'];
try {
switch ($obj['fk_type']) {
case 1:
$this->connector = new DummyPrintConnector();
break;
case 2:
$this->connector = new FilePrintConnector($parameter);
break;
case 3:
$parameters = explode(':', $parameter);
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
break;
case 4: // LPT1, smb://...
$this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
break;
case 5:
$this->connector = new CupsPrintConnector($parameter);
break;
default:
$this->connector = 'CONNECTOR_UNKNOWN';
break;
}
$this->printer = new Printer($this->connector, $this->profile);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
$error++;
}
}
return $error; return $error;
} }
} }

View File

@ -527,102 +527,100 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
if ($mode == 'target' || preg_match('/targetwithdetails/', $mode)) { if ($mode == 'target' || preg_match('/targetwithdetails/', $mode)) {
if ($usecontact) { if ($usecontact) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1)); if (is_object($targetcontact)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
if (!empty($targetcontact->address)) { if (!empty($targetcontact->address)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact)); $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
} else { } else {
$companytouseforaddress = $targetcompany; $companytouseforaddress = $targetcompany;
// Contact on a thirdparty that is a different thirdparty than the thirdparty of object // Contact on a thirdparty that is a different thirdparty than the thirdparty of object
if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) { if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
$targetcontact->fetch_thirdparty(); $targetcontact->fetch_thirdparty();
$companytouseforaddress = $targetcontact->thirdparty; $companytouseforaddress = $targetcontact->thirdparty;
}
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
}
// Country
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
} elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
} }
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress)); if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
} // Phone
// Country if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) { if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code)); $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
} elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) { }
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code)); if (!empty($targetcontact->phone_pro)) {
} $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
}
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) { if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
// Phone $stringaddress .= " / ";
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) { }
if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) { if (!empty($targetcontact->phone_mobile)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": "; $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
}
} }
if (!empty($targetcontact->phone_pro)) { // Fax
$stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcontact->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
}
} }
if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) { // EMail
$stringaddress .= " / "; if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcontact->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
}
} }
if (!empty($targetcontact->phone_mobile)) { // Web
$stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
} if ($targetcontact->url) {
} $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
// Fax }
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcontact->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
}
}
// EMail
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcontact->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
}
}
// Web
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
if ($targetcontact->url) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
} }
} }
} }
} else { } else {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany)); if (is_object($targetcompany)) {
// Country $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) { // Country
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code)); if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
} $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
}
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) { if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
// Phone // Phone
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) { if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
if (!empty($targetcompany->phone) || !empty($targetcompany->phone_mobile)) { if (!empty($targetcompany->phone)) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": "; $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
}
if (!empty($targetcompany->phone)) {
$stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
}
} }
if (!empty($targetcompany->phone)) { // Fax
$stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone); if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcompany->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
}
} }
if (!empty($targetcompany->phone) && !empty($targetcompany->phone_mobile)) { // EMail
$stringaddress .= " / "; if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcompany->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
}
} }
if (!empty($targetcompany->phone_mobile)) { // Web
$stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile); if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
} if ($targetcompany->url) {
} $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
// Fax }
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
if ($targetcompany->fax) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
}
}
// EMail
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
if ($targetcompany->email) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
}
}
// Web
if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
if ($targetcompany->url) {
$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
} }
} }
} }

View File

@ -138,6 +138,14 @@ class pdf_beluga extends ModelePDFProjects
*/ */
public $emetteur; public $emetteur;
public $posxref;
public $posxdate;
public $posxsociete;
public $posxamountht;
public $posxamountttc;
public $posstatut;
/** /**
* Constructor * Constructor
* *
@ -479,7 +487,7 @@ class pdf_beluga extends ModelePDFProjects
} }
//var_dump("$key, $tablename, $datefieldname, $dates, $datee"); //var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, $projectField); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, '', '', $projectField);
$num = count($elementarray); $num = count($elementarray);
if ($num >= 0) { if ($num >= 0) {
@ -492,7 +500,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L'); $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
$selectList = $formproject->select_element($tablename, $project->thirdparty->id, '', -2, $projectField); $selectList = $formproject->select_element($tablename, $object->thirdparty->id, '', -2, $projectField);
$nexY = $pdf->GetY() + 1; $nexY = $pdf->GetY() + 1;
$curY = $nexY; $curY = $nexY;
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
@ -790,8 +798,6 @@ class pdf_beluga extends ModelePDFProjects
*/ */
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{ {
global $conf, $mysoc;
$heightoftitleline = 10; $heightoftitleline = 10;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
@ -806,24 +812,6 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size); $pdf->SetFont('', '', $default_font_size);
$pdf->SetXY($this->posxref, $tab_top + 1);
$pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->transnoentities("Tasks"), '', 'L');
$pdf->SetXY($this->posxlabel, $tab_top + 1);
$pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
$pdf->SetXY($this->posxworkload, $tab_top + 1);
$pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R');
$pdf->SetXY($this->posxprogress, $tab_top + 1);
$pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R');
$pdf->SetXY($this->posxdatestart, $tab_top + 1);
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C');
$pdf->SetXY($this->posxdateend, $tab_top + 1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore

View File

@ -240,7 +240,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
unset($linked_contacts); unset($linked_contacts);
} }
if ($sendto) { if ($sendto) {
$this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf); $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
} }
} }
$ok = 1; $ok = 1;

View File

@ -1029,10 +1029,8 @@ if ($step == 4 && $datatoimport) {
print '<div id="left" class="connectedSortable">'."\n"; print '<div id="left" class="connectedSortable">'."\n";
// List of source fields // List of source fields
$var = true;
$lefti = 1; $lefti = 1;
foreach ($fieldssource as $key => $val) { foreach ($fieldssource as $key => $val) {
$var = !$var;
show_elem($fieldssource, $key, $val, $var); // key is field number in source file show_elem($fieldssource, $key, $val, $var); // key is field number in source file
$listofkeys[$key] = 1; $listofkeys[$key] = 1;
$fieldsplaced[$key] = 1; $fieldsplaced[$key] = 1;
@ -2210,7 +2208,7 @@ $db->close();
* @param array $fieldssource List of source fields * @param array $fieldssource List of source fields
* @param int $pos Pos * @param int $pos Pos
* @param string $key Key * @param string $key Key
* @param boolean $var Line style (odd or not) * @param boolean $var Line style (odd or not). No more used.
* @param int $nostyle Hide style * @param int $nostyle Hide style
* @return void * @return void
*/ */

View File

@ -1422,11 +1422,9 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf)
if ($select_resql) { if ($select_resql) {
$select_num = $db->num_rows($select_resql); $select_num = $db->num_rows($select_resql);
$i = 0; $i = 0;
$var = true;
// Pour chaque paiement fournisseur, on insere une ligne dans paiementfourn_facturefourn // Pour chaque paiement fournisseur, on insere une ligne dans paiementfourn_facturefourn
while (($i < $select_num) && (!$error)) { while (($i < $select_num) && (!$error)) {
$var = !$var;
$select_obj = $db->fetch_object($select_resql); $select_obj = $db->fetch_object($select_resql);
// Verifier si la ligne est deja dans la nouvelle table. On ne veut pas inserer de doublons. // Verifier si la ligne est deja dans la nouvelle table. On ne veut pas inserer de doublons.

View File

@ -1367,7 +1367,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
if ($dirins && $action == 'initdic' && $module && $dicname) { if ($dirins && $action == 'initdic' && $module && $dicname) {
if (!$error) { if (!$error) {
$newdicname = $dicname; $newdicname = $dicname;
if (!preg_match('/^c_/, $newdicname')) { if (!preg_match('/^c_/', $newdicname)) {
$newdicname = 'c_'.$dicname; $newdicname = 'c_'.$dicname;
} }

View File

@ -1268,6 +1268,7 @@ if ($action == 'create' || $action == 'presend') {
$companystatic = new Societe($db); $companystatic = new Societe($db);
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$userstatic = new User($db); $userstatic = new User($db);
$var = false;
foreach (array('internal', 'external') as $source) { foreach (array('internal', 'external') as $source) {
$tmpobject = $object; $tmpobject = $object;
$tab = $tmpobject->listeContact(-1, $source); $tab = $tmpobject->listeContact(-1, $source);

View File

@ -257,7 +257,7 @@ $formfile = new FormFile($db);
if ($action == 'create') { if ($action == 'create') {
print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group'); print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group');
print dol_set_focus('#nom'); dol_set_focus('#nom');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';