Skip to content

Commit

Permalink
Merge branch 'develop' into 20_add_fields_array_to_categories_class
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry authored Aug 5, 2024
2 parents 730e383 + e3d3bad commit ac14370
Show file tree
Hide file tree
Showing 284 changed files with 3,465 additions and 1,818 deletions.
939 changes: 401 additions & 538 deletions dev/tools/phan/baseline.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dev/tools/phan/config_extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
'PhanPluginRedundantAssignment', // Not essential, useless
'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences

'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time
'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time
];

return $config;
6 changes: 3 additions & 3 deletions htdocs/accountancy/admin/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@

// Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>';
print '<td><input name="account_number" size="30" value="'.$object->account_number.'"</td></tr>';
print '<td><input name="account_number" size="30" value="'.$object->account_number.'"></td></tr>';

// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>';
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';

// Label short
print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"</td></tr>';
print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"></td></tr>';

// Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
Expand Down
10 changes: 7 additions & 3 deletions htdocs/accountancy/bookkeeping/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
}

if (!$error) {
$datedoc = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear'));

$object = new BookKeeping($db);

$object->numero_compte = $accountingaccount_number;
Expand All @@ -189,7 +191,7 @@
$object->label_operation = $label_operation;
$object->debit = $debit;
$object->credit = $credit;
$object->doc_date = (string) GETPOST('doc_date', 'alpha');
$object->doc_date = $datedoc;
$object->doc_type = (string) GETPOST('doc_type', 'alpha');
$object->piece_num = $piece_num;
$object->doc_ref = (string) GETPOST('doc_ref', 'alpha');
Expand Down Expand Up @@ -258,10 +260,12 @@
}

if (!$error) {
$date_start = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear'));

$object->label_compte = '';
$object->debit = 0;
$object->credit = 0;
$object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear'));
$object->doc_date = $date_start;
$object->doc_type = GETPOST('doc_type', 'alpha');
$object->piece_num = GETPOSTINT('next_num_mvt');
$object->doc_ref = GETPOST('doc_ref', 'alpha');
Expand Down Expand Up @@ -482,7 +486,7 @@
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', 0, 0, 0, "setdate");
print $form->selectDate($object->doc_date ? $object->doc_date : -1, 'doc_date', 0, 0, 0, "setdate");
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@
// Journal code
if (!empty($arrayfields['t.code_journal']['checked'])) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$result = $accountingjournal->fetch(0, $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center tdoverflowmax150">'.$journaltoshow.'</td>';
if (!$i) {
Expand Down
10 changes: 6 additions & 4 deletions htdocs/accountancy/bookkeeping/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@
} elseif ($action == 'unletteringmanual' && $confirm == "yes") {
$lettering = new Lettering($db);
$nb_lettering = $lettering->deleteLettering($toselect);
if ($result < 0) {
if ($nb_lettering < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
Expand Down Expand Up @@ -1212,8 +1212,10 @@
}

// Document ref
$modulepart = '';
$modulepart = ''; // may be used by include*.tpl.php
if (!empty($arrayfields['t.doc_ref']['checked'])) {
$objectstatic = null;

if ($line->doc_type === 'customer_invoice') {
$langs->loadLangs(array('bills'));

Expand Down Expand Up @@ -1270,11 +1272,11 @@
$labeltoshow = '';
$labeltoshowalt = '';
$classforlabel = '';
if ($line->doc_type === 'customer_invoice' || $line->doc_type === 'supplier_invoice' || $line->doc_type === 'expense_report') {
if (($line->doc_type === 'customer_invoice' || $line->doc_type === 'supplier_invoice' || $line->doc_type === 'expense_report') && is_object($objectstatic)) {
$labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
$labeltoshow .= $documentlink;
$labeltoshowalt .= $objectstatic->ref;
} elseif ($line->doc_type === 'bank') {
} elseif ($line->doc_type === 'bank' && is_object($objectstatic)) {
$labeltoshow .= $objectstatic->getNomUrl(1);
$labeltoshowalt .= $objectstatic->ref;
$bank_ref = strstr($line->doc_ref, '-');
Expand Down
26 changes: 13 additions & 13 deletions htdocs/accountancy/class/bookkeeping.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
class BookKeeping extends CommonObject
{
/**
* @var string Id to identify managed objects
* @var string Id to identify managed objects
*/
public $element = 'accountingbookkeeping';

/**
* @var string Name of table without prefix where object is stored
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'accounting_bookkeeping';

/**
* @var int Entity
* @var int Entity
*/
public $entity;

Expand All @@ -58,52 +58,52 @@ class BookKeeping extends CommonObject
public $lines = array();

/**
* @var int ID
* @var int ID
*/
public $id;

/**
* @var int Date of source document, in db date NOT NULL
* @var int Date of source document, in db date NOT NULL
*/
public $doc_date;

/**
* @var int Deadline for payment
* @var int Deadline for payment
*/
public $date_lim_reglement;

/**
* @var string doc_type
* @var string Doc type
*/
public $doc_type;

/**
* @var string doc_ref
* @var string Doc ref
*/
public $doc_ref;

/**
* @var int ID
* @var int ID
*/
public $fk_doc;

/**
* @var int ID
* @var int ID
*/
public $fk_docdet;

/**
* @var string thirdparty code
* @var string Thirdparty code
*/
public $thirdparty_code;

/**
* @var string subledger account
* @var string|null Subledger account
*/
public $subledger_account;

/**
* @var string subledger label
* @var string|null Subledger label
*/
public $subledger_label;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/class/lettering.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public function updateLettering($ids = array(), $notrigger = 0, $partial = false
*
* @param array $ids ids array
* @param int $notrigger no trigger
* @return int
* @return int Nb of affectd rows or <0 if error
*/
public function deleteLettering($ids, $notrigger = 0)
{
Expand Down
10 changes: 5 additions & 5 deletions htdocs/adherents/class/api_members.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getByThirdparty($thirdparty)
}

$member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty);
$result = $member->fetch(0, '', $thirdparty);
if (!$result) {
throw new RestException(404, 'member not found');
}
Expand Down Expand Up @@ -141,13 +141,13 @@ public function getByThirdpartyEmail($email)
}

$thirdparty = new Societe($this->db);
$result = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
$result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $email);
if (!$result) {
throw new RestException(404, 'thirdparty not found');
}

$member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty->id);
$result = $member->fetch(0, '', $thirdparty->id);
if (!$result) {
throw new RestException(404, 'member not found');
}
Expand Down Expand Up @@ -180,13 +180,13 @@ public function getByThirdpartyBarcode($barcode)
}

$thirdparty = new Societe($this->db);
$result = $thirdparty->fetch('', '', '', $barcode);
$result = $thirdparty->fetch(0, '', '', $barcode);
if (!$result) {
throw new RestException(404, 'thirdparty not found');
}

$member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty->id);
$result = $member->fetch(0, '', $thirdparty->id);
if (!$result) {
throw new RestException(404, 'member not found');
}
Expand Down
18 changes: 10 additions & 8 deletions htdocs/adherents/type.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
$membertype = new AdherentType($db);

$i = 0;
$savnbfield = 9;
$savnbfield = 10;
/*$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;*/
Expand Down Expand Up @@ -565,6 +565,7 @@
print yn($object->vote);
print '</tr>';

// Duration
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
if ($object->duration_value > 1) {
$dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
Expand All @@ -574,13 +575,15 @@
print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
print '</td></tr>';

print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td><div class="longmessagecut">';
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public));
print "</td></tr>";
print "</div></td></tr>";

print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
// Welcome email content
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td><div class="longmessagecut">';
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->mail_valid));
print "</td></tr>";
print "</div></td></tr>";

// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
Expand Down Expand Up @@ -750,9 +753,6 @@
if (!empty($search_lastname)) {
$param .= "&search_lastname=".urlencode($search_lastname);
}
if (!empty($search_firstname)) {
$param .= "&search_firstname=".urlencode($search_firstname);
}
if (!empty($search_login)) {
$param .= "&search_login=".urlencode($search_login);
}
Expand All @@ -770,6 +770,7 @@
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'"></td>';
print '<input class="flat" type="hidden" name="page_y" value=""></td>';

print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);

Expand Down Expand Up @@ -848,6 +849,7 @@
$adh->datefin = $datefin;
$adh->need_subscription = $objp->subscription;
$adh->statut = $objp->status;
$adh->status = $objp->status;
$adh->email = $objp->email;
$adh->photo = $objp->photo;

Expand Down
12 changes: 7 additions & 5 deletions htdocs/admin/dict.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
continue;
}
$tabcomplete[$key]['id'] = $i;
// TODO Comment the line when data is stored into the tabcomplete array
// TODO Comment this lines when data is stored into the tabcomplete array
$tabcomplete[$key]['cond'] = $tabcond[$i];
$tabcomplete[$key]['rowid'] = $tabrowid[$i];
$tabcomplete[$key]['fieldinsert'] = $tabfieldinsert[$i];
Expand Down Expand Up @@ -2247,8 +2247,8 @@
if (!is_null($withentity)) {
print '<input type="hidden" name="entity" value="'.$withentity.'">';
}
print '<input type="submit" class="button button-edit small" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel small" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
} else {
$tmpaction = 'view';
Expand Down Expand Up @@ -2303,8 +2303,10 @@
} elseif ($value == 'price' || preg_match('/^amount/i', $value)) {
$valuetoshow = price($valuetoshow);
}
if ($value == 'private') {
$valuetoshow = yn($valuetoshow);
if (in_array($value, array('private', 'joinfile', 'use_default'))) {
if ($valuetoshow) {
$valuetoshow = yn($valuetoshow);
}
} elseif ($value == 'libelle_facture') {
$key = $langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value);
Expand Down
Loading

0 comments on commit ac14370

Please sign in to comment.