|
3098 | 3098 | // Show warnings |
3099 | 3099 |
|
3100 | 3100 | if (empty($welcomecid) && ! in_array($action, array('instanceverification', 'autoupgrade'))) { |
| 3101 | + // Show warnings on invoice dispute |
| 3102 | + $sql = 'SELECT f.rowid, f.ref, f.datef, f.datec, f.date_lim_reglement as date_due, f.dispute_status, fe.invoicepaymentdisputed'; |
| 3103 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facture_extrafields as fe'; |
| 3104 | + $sql .= ' WHERE fe.fk_object = f.rowid AND f.fk_soc = '.((int) $mythirdpartyaccount->id); |
| 3105 | + $sql .= ' AND dispute_status = 1'; |
| 3106 | + $sql .= ' ORDER BY f.datef'; |
| 3107 | + $sql .= ' LIMIT 100'; |
| 3108 | + |
| 3109 | + $resql = $db->query($sql); |
| 3110 | + if ($resql) { |
| 3111 | + $num_rows = $db->num_rows($resql); |
| 3112 | + $i=0; |
| 3113 | + if ($num_rows) { |
| 3114 | + $atleastoneinvoicedisputed++; |
| 3115 | + $listofreftoshow = ''; |
| 3116 | + |
| 3117 | + while ($obj = $db->fetch_object($resql)) { |
| 3118 | + $listofreftoshow .= ($listofreftoshow ? ', ' : $listofreftoshow).$obj->ref.' ('.dol_print_date($db->jdate($obj->datec), 'day', 'gmt').')'; |
| 3119 | + } |
| 3120 | + |
| 3121 | + if ($listofreftoshow) { |
| 3122 | + print ' |
| 3123 | + <!-- Warnings disputed --> |
| 3124 | + <div class="note note-warning note-disputed"> |
| 3125 | + <h4 class="block">'.$langs->trans("InvoicePaymentDisputedMessage", $listofreftoshow).'</h4> |
| 3126 | + </div> |
| 3127 | + '; |
| 3128 | + } |
| 3129 | + } |
| 3130 | + } else { |
| 3131 | + dol_print_error($db); |
| 3132 | + } |
| 3133 | + |
| 3134 | + |
3101 | 3135 | $companypaymentmode = new CompanyPaymentMode($db); |
3102 | 3136 | $result = $companypaymentmode->fetch(0, null, $mythirdpartyaccount->id); |
3103 | 3137 |
|
|
3396 | 3430 | } else { |
3397 | 3431 | dol_print_error($db); |
3398 | 3432 | } |
3399 | | - |
3400 | | - // Test if there is one invoice disputed |
3401 | | - $sql = 'SELECT f.rowid, f.ref, f.datef, f.datec, f.date_lim_reglement as date_due, f.dispute_status, fe.invoicepaymentdisputed'; |
3402 | | - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facture_extrafields as fe'; |
3403 | | - $sql .= ' WHERE fe.fk_object = f.rowid AND f.fk_soc = '.((int) $mythirdpartyaccount->id); |
3404 | | - $sql .= ' AND dispute_status = 1'; |
3405 | | - $sql .= ' ORDER BY f.datef'; |
3406 | | - $sql .= ' LIMIT 1'; |
3407 | | - |
3408 | | - $resql = $db->query($sql); |
3409 | | - if ($resql) { |
3410 | | - $num_rows = $db->num_rows($resql); |
3411 | | - $i=0; |
3412 | | - if ($num_rows) { |
3413 | | - $atleastoneinvoicedisputed++; |
3414 | | - |
3415 | | - while ($obj = $db->fetch_object($resql)) { |
3416 | | - print ' |
3417 | | - <div class="note note-warning note-disputed"> |
3418 | | - <h4 class="block">'.$langs->trans("InvoicePaymentDisputedMessage", $obj->ref, dol_print_date($db->jdate($obj->datec), 'day', 'gmt')).'</h4> |
3419 | | - </div> |
3420 | | - '; |
3421 | | - } |
3422 | | - } |
3423 | | - } else { |
3424 | | - dol_print_error($db); |
3425 | | - } |
3426 | 3433 | } |
3427 | 3434 |
|
3428 | 3435 |
|
|
0 commit comments