Merge remote-tracking branch 'upstream/develop' into loaddolibarrenv
This commit is contained in:
commit
1c2a89f52d
@ -886,9 +886,11 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
$fieldname = 'country';
|
||||
if ($context == 'add') {
|
||||
$fieldname = 'country_id';
|
||||
print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
$preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code;
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
} else {
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
$preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code);
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'country_id') {
|
||||
|
||||
@ -785,12 +785,13 @@ class AccountancyCategory // extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of custom groups that are active
|
||||
* Return list of custom groups.
|
||||
*
|
||||
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||
* @param int $active 1= active, 0=not active
|
||||
* @return array|int Array of groups or -1 if error
|
||||
*/
|
||||
public function getCats($categorytype = -1)
|
||||
public function getCats($categorytype = -1, $active = 1)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
|
||||
@ -801,7 +802,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql .= " WHERE c.active = 1";
|
||||
$sql .= " WHERE c.active = " . (int) $active;
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
if ($categorytype >= 0) {
|
||||
$sql .= " AND c.category_type = 1";
|
||||
|
||||
@ -335,8 +335,8 @@ class Adherent extends CommonObject
|
||||
'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145),
|
||||
'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150),
|
||||
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165),
|
||||
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170),
|
||||
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175),
|
||||
|
||||
@ -350,7 +350,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
}
|
||||
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
||||
if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) {
|
||||
// We need this table joined to the select in order to filter by categ
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
|
||||
}
|
||||
|
||||
@ -2087,7 +2087,7 @@ if ($id > 0) {
|
||||
} elseif ($value == 'fk_tva') {
|
||||
foreach ($form->cache_vatrates as $key => $Tab) {
|
||||
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow) {
|
||||
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
|
||||
$valuetoshow = $form->cache_vatrates[$key]['label'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1061,21 +1061,57 @@ if ($num) {
|
||||
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
||||
}
|
||||
|
||||
// If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email).
|
||||
// Note that local link to a file into medias are replaced with a real link by email in CMailFile.class.php with value $urlwithroot defined like this:
|
||||
// $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
// $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
$acceptlocallinktomedia = getDolGlobalInt('MAIN_DISALLOW_MEDIAS_IN_EMAIL_TEMPLATES') ? 0 : 1;
|
||||
if ($acceptlocallinktomedia) {
|
||||
global $dolibarr_main_url_root;
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
|
||||
// Parse $newUrl
|
||||
$newUrlArray = parse_url($urlwithouturlroot);
|
||||
$hosttocheck = $newUrlArray['host'];
|
||||
$hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6
|
||||
|
||||
if (function_exists('gethostbyname')) {
|
||||
$iptocheck = gethostbyname($hosttocheck);
|
||||
} else {
|
||||
$iptocheck = $hosttocheck;
|
||||
}
|
||||
|
||||
//var_dump($iptocheck.' '.$acceptlocallinktomedia);
|
||||
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
// If ip of public url is an private network IP, we do not allow this.
|
||||
$acceptlocallinktomedia = 0;
|
||||
// TODO Show a warning
|
||||
}
|
||||
|
||||
if (preg_match('/http:/i', $urlwithouturlroot)) {
|
||||
// If public url is not a https, we do not allow to add medias link. It will generate security alerts when email will be sent.
|
||||
$acceptlocallinktomedia = 0;
|
||||
// TODO Show a warning
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpfieldlist == 'content') {
|
||||
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$okforextended = false;
|
||||
}
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%');
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
if ($tmpfieldlist == 'content_lines') {
|
||||
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
}
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
function printDropdownBookmarksList()
|
||||
{
|
||||
global $conf, $user, $db, $langs;
|
||||
global $conf, $user, $db, $langs, $sortfield, $sortorder;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
@ -48,7 +48,6 @@ function printDropdownBookmarksList()
|
||||
}
|
||||
}
|
||||
}
|
||||
global $sortfield, $sortorder;
|
||||
$tmpurl = '';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) {
|
||||
|
||||
@ -322,8 +322,8 @@ class Propal extends CommonObject
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
|
||||
@ -330,8 +330,8 @@ class Commande extends CommonOrder
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
|
||||
|
||||
@ -315,7 +315,7 @@ class Account extends CommonObject
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
|
||||
@ -185,8 +185,8 @@ class FactureRec extends CommonInvoice
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
@ -144,7 +144,8 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* @var string customer ref
|
||||
*/
|
||||
public $ref_client;
|
||||
public $ref_client; // deprecated; use ref_customer instead
|
||||
public $ref_customer;
|
||||
|
||||
/**
|
||||
* @var int Ref Int
|
||||
@ -335,8 +336,8 @@ class Facture extends CommonInvoice
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
|
||||
@ -1985,8 +1986,9 @@ class Facture extends CommonInvoice
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_customer = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->type = $obj->type;
|
||||
$this->date = $this->db->jdate($obj->df);
|
||||
|
||||
@ -112,8 +112,14 @@ if (empty($reshook)) {
|
||||
$sourcetype = 'supplier_invoice';
|
||||
$newtype = 'bank-transfer';
|
||||
}
|
||||
$paymentservice = GETPOST('paymentservice');
|
||||
|
||||
if (preg_match('/stripesepa/', $paymentservice)) {
|
||||
$result = $object->demande_prelevement_stripe($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
} else {
|
||||
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
}
|
||||
|
||||
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
|
||||
@ -737,6 +743,22 @@ if ($object->id > 0) {
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
|
||||
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
|
||||
print '</form>';
|
||||
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
print "<br>";
|
||||
//add stripe sepa button
|
||||
$buttonlabel = $langs->trans("MakeWithdrawRequestStripe");
|
||||
print '<form method="POST" action="">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'" />';
|
||||
print '<input type="hidden" name="type" value="'.$type.'" />';
|
||||
print '<input type="hidden" name="action" value="new" />';
|
||||
print '<input type="hidden" name="paymenservice" value="stripesepa" />';
|
||||
print '<label for="withdraw_request_amount">'.$langs->trans('BankTransferAmount').' </label>';
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
|
||||
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$buttonlabel.'</a>';
|
||||
}
|
||||
|
||||
@ -1065,7 +1065,11 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
//No need of GROUP BY
|
||||
} else {
|
||||
$sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
}
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'p.ref';
|
||||
@ -1523,15 +1527,17 @@ $hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
|
||||
// Total
|
||||
print '<tr>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print '<td colspan="'.($modecompta == 'BOOKKEEPING' ? 3 : 4).'"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
|
||||
@ -1539,7 +1545,7 @@ print '</tr>';
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
|
||||
@ -1547,7 +1553,7 @@ print '</tr>';
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
|
||||
|
||||
@ -275,6 +275,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
// Get array of all report groups that are active
|
||||
$cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include
|
||||
$unactive_cats = $AccCat->getCats(-1, 0);
|
||||
|
||||
/*
|
||||
$sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa';
|
||||
@ -326,6 +327,11 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Unactive categories have a total of 0 to be used in the formula.
|
||||
foreach ($unactive_cats as $un_cat) {
|
||||
$vars[$un_cat['code']] = 0;
|
||||
}
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach ($sommes as $code => $det) {
|
||||
$vars[$code] = $det['NP'];
|
||||
@ -406,6 +412,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
// Set $cpts with array of accounts in the category/group
|
||||
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
||||
// We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number.
|
||||
if (empty($cpts)) $cpts[] = array();
|
||||
|
||||
|
||||
$arrayofaccountforfilter = array();
|
||||
foreach ($cpts as $i => $cpt) { // Loop on each account.
|
||||
@ -478,7 +487,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
// Label of group
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($cat['label']);
|
||||
if (count($cpts) > 0) { // Show example of 5 first accounting accounts
|
||||
if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts
|
||||
$i = 0;
|
||||
foreach ($cpts as $cpt) {
|
||||
if ($i > 5) {
|
||||
|
||||
@ -237,8 +237,8 @@ class Contrat extends CommonObject
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
|
||||
@ -214,6 +214,15 @@ if ($action == "importSignature") {
|
||||
$db->commit();
|
||||
$response = "success";
|
||||
setEventMessages("PropalSigned", null, 'warnings');
|
||||
if (method_exists($object, 'call_trigger')) {
|
||||
//customer is not a user !?! so could we use same user as validation ?
|
||||
$user = new User($db);
|
||||
$user->fetch($object->user_valid_id);
|
||||
$result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
$error++;
|
||||
|
||||
@ -68,7 +68,7 @@ class DolEditor
|
||||
* @param int $readonly 0=Read/Edit, 1=Read only
|
||||
* @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y)
|
||||
*/
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array())
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array())
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
@ -1055,7 +1055,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Use MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
if ($foruserprofile) {
|
||||
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
|
||||
$default = $langs->trans('No');
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -969,8 +969,16 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -548,8 +548,16 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
//*********************LOGO****************************
|
||||
$pdf->SetXY(11, 7);
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -914,8 +914,16 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -164,8 +164,9 @@ class modCategorie extends DolibarrModules
|
||||
$typeexample .= ($typeexample ? " / " : "")."11=Website page";
|
||||
}
|
||||
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel");
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'pcat.label'=>'Text');
|
||||
// Definition of vars
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel");
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text');
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another picto
|
||||
$this->export_help_array[$r] = array('cat.type'=>$typeexample);
|
||||
|
||||
@ -181,8 +182,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = 'isModEnabled("product") || !empty($conf->service->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'product';
|
||||
@ -192,6 +193,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cp.fk_product';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -206,7 +208,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = 'isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_fournisseur'=>"SupplierCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode",
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||
@ -214,7 +216,7 @@ class modCategorie extends DolibarrModules
|
||||
't.libelle'=>'ThirdPartyType'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.fournisseur'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_fournisseur'=>"Text",
|
||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text",
|
||||
@ -236,6 +238,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cf.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||
@ -252,7 +255,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = 'isModEnabled("societe")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode",
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||
@ -260,7 +263,7 @@ class modCategorie extends DolibarrModules
|
||||
't.libelle'=>'ThirdPartyType', 'pl.code'=>'ProspectLevel', 'st.code'=>'ProspectStatus'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text",
|
||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text",
|
||||
@ -282,6 +285,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cs.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||
@ -299,8 +303,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = 'isModEnabled("adherent")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'adherent';
|
||||
@ -310,6 +314,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_member as cm ON cm.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'adherent as p ON p.rowid = cm.fk_member';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON cat.rowid = extra.fk_object ';
|
||||
@ -324,7 +329,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = 'isModEnabled("societe")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "contact", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
'p.rowid' => 'ContactId', 'civ.label' => 'UserTitle', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname',
|
||||
'p.address' => 'Address', 'p.zip' => 'Zip', 'p.town' => 'Town', 'c.code' => 'CountryCode', 'c.label' => 'Country',
|
||||
'p.birthday' => 'DateOfBirth', 'p.poste' => 'PostOrFunction',
|
||||
@ -335,8 +340,8 @@ class modCategorie extends DolibarrModules
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email"
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'civ.label' => 'List:c_civility:label:label', 'p.lastname' => 'Text', 'p.firstname' => 'Text',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
'civ.label' => 'List:c_civility:label:label', 'p.rowid'=>'Numeric', 'p.lastname' => 'Text', 'p.firstname' => 'Text',
|
||||
'p.address' => 'Text', 'p.zip' => 'Text', 'p.town' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_country:label:label',
|
||||
'p.birthday' => 'Date', 'p.poste' => 'Text',
|
||||
'p.phone' => 'Text', 'p.phone_perso' => 'Text', 'p.phone_mobile' => 'Text', 'p.fax' => 'Text', 'p.email' => 'Text',
|
||||
@ -363,6 +368,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_contact as cc ON cc.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'socpeople as p ON p.rowid = cc.fk_socpeople';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -381,8 +387,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = "isModEnabled('project')";
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text");
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text");
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'projet';
|
||||
@ -392,6 +398,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_project as cp ON cp.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'projet as p ON p.rowid = cp.fk_project';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -406,8 +413,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = '!empty($conf->user->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'TechnicalID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'UserID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'user';
|
||||
@ -417,6 +424,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_user as cu ON cu.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'user as p ON p.rowid = cu.fk_user';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
|
||||
@ -161,31 +161,39 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
*/
|
||||
public function getExample($langs, $objsoc = 0, $type = -1)
|
||||
{
|
||||
$error = 0;
|
||||
$examplecust = '';
|
||||
$examplesup = '';
|
||||
$errmsg = array(
|
||||
"ErrorBadMask",
|
||||
"ErrorCantUseRazIfNoYearInMask",
|
||||
"ErrorCantUseRazInStartedYearIfNoYearMonthInMask",
|
||||
"ErrorCounterMustHaveMoreThan3Digits",
|
||||
"ErrorBadMaskBadRazMonth",
|
||||
"ErrorCantUseRazWithYearOnOneDigit",
|
||||
);
|
||||
if ($type != 1) {
|
||||
$examplecust = $this->getNextValue($objsoc, 0);
|
||||
if (!$examplecust) {
|
||||
$examplecust = $langs->trans('NotConfigured');
|
||||
$examplecust = '<div class="error">'.$langs->trans('NotConfigured').'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
if (in_array($examplecust, $errmsg)) {
|
||||
$langs->load("errors");
|
||||
$examplecust = $langs->trans($examplecust);
|
||||
$examplecust = '<div class="error">'.$langs->trans($examplecust).'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
if ($type != 0) {
|
||||
$examplesup = $this->getNextValue($objsoc, 1);
|
||||
if (!$examplesup) {
|
||||
$examplesup = $langs->trans('NotConfigured');
|
||||
$examplesup = '<div class="error">'.$langs->trans('NotConfigured').'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
if (in_array($examplesup, $errmsg)) {
|
||||
$langs->load("errors");
|
||||
$examplesup = $langs->trans($examplesup);
|
||||
$examplesup = '<div class="error">'.$langs->trans($examplesup).'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +202,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
} elseif ($type == 1) {
|
||||
return $examplesup;
|
||||
} else {
|
||||
return $examplecust.'<br>'.$examplesup;
|
||||
if ($error == 1) {
|
||||
return $examplecust.' '.$examplesup;
|
||||
} else {
|
||||
return $examplecust.'<br>'.$examplesup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ function datapolicyAdminPrepareHead()
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS) || getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
|
||||
if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS) || getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setupmail.php";
|
||||
$head[$h][1] = $langs->trans("DATAPOLICYMail");
|
||||
$head[$h][2] = 'emailing';
|
||||
|
||||
@ -260,9 +260,10 @@ llxHeader('', $title, 'Livraison');
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
if ($action == 'create') { // Create. Seems to no be used
|
||||
} else // View
|
||||
{
|
||||
if ($action == 'create') {
|
||||
// Create. Seems to no be used
|
||||
} else {
|
||||
// View
|
||||
if ($object->id > 0) {
|
||||
// Origin of a 'livraison' (delivery receipt) is ALWAYS 'expedition' (shipment).
|
||||
// However, origin of shipment in future may differs (commande, proposal, ...)
|
||||
|
||||
@ -408,11 +408,17 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) {
|
||||
// Build a receiving receipt
|
||||
$db->begin();
|
||||
|
||||
$result = $object->create_delivery($user);
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/delivery/card.php?action=create_delivery&id='.$result);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
@ -549,6 +555,7 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
$lines = $object->lines;
|
||||
$line = new ExpeditionLigne($db);
|
||||
$line->fk_expedition = $object->id;
|
||||
|
||||
$num_prod = count($lines);
|
||||
for ($i = 0; $i < $num_prod; $i++) {
|
||||
@ -590,6 +597,7 @@ if (empty($reshook)) {
|
||||
for ($i = 0; $i < $num_prod; $i++) {
|
||||
if ($lines[$i]->id == $line_id) { // we have found line to update
|
||||
$line = new ExpeditionLigne($db);
|
||||
$line->fk_expedition = $object->id;
|
||||
|
||||
// Extrafields Lines
|
||||
$line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
|
||||
|
||||
@ -694,7 +694,7 @@ if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
|
||||
// Delivery method
|
||||
print '<td class="liste_titre center">';
|
||||
$shipment->fetch_delivery_methods();
|
||||
print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1);
|
||||
print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1, 0, 0, '', 'maxwidth150');
|
||||
print "</td>\n";
|
||||
}
|
||||
// Tracking number
|
||||
@ -959,7 +959,7 @@ while ($i < min($num, $limit)) {
|
||||
if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
|
||||
// Get code using getLabelFromKey
|
||||
$code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
|
||||
print '<td class="center">';
|
||||
print '<td class="center tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("SendingMethod".strtoupper($code))).'">';
|
||||
if ($shipment->shipping_method_id > 0) print $langs->trans("SendingMethod".strtoupper($code));
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -236,8 +236,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>3, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>1, 'position'=>145, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155, 'searchall'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165),
|
||||
'fk_input_method' =>array('type'=>'integer', 'label'=>'OrderMode', 'enabled'=>1, 'visible'=>3, 'position'=>170),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175),
|
||||
|
||||
@ -302,8 +302,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
|
||||
@ -194,11 +194,13 @@ delete from llx_delivery where rowid not in (select fk_target from llx_elemen
|
||||
|
||||
-- Fix delete element_element orphelins (right side)
|
||||
delete from llx_element_element where targettype='shipping' and fk_target not in (select rowid from llx_expedition);
|
||||
delete from llx_element_element where targettype='delivery' and fk_target not in (select rowid from llx_delivery);
|
||||
delete from llx_element_element where targettype='propal' and fk_target not in (select rowid from llx_propal);
|
||||
delete from llx_element_element where targettype='facture' and fk_target not in (select rowid from llx_facture);
|
||||
delete from llx_element_element where targettype='commande' and fk_target not in (select rowid from llx_commande);
|
||||
-- Fix delete element_element orphelins (left side)
|
||||
delete from llx_element_element where sourcetype='shipping' and fk_source not in (select rowid from llx_expedition);
|
||||
delete from llx_element_element where sourcetype='delivery' and fk_source not in (select rowid from llx_delivery);
|
||||
delete from llx_element_element where sourcetype='propal' and fk_source not in (select rowid from llx_propal);
|
||||
delete from llx_element_element where sourcetype='facture' and fk_source not in (select rowid from llx_facture);
|
||||
delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande);
|
||||
|
||||
@ -67,6 +67,7 @@ StockCategoriesShort=Warehouse tags/categories
|
||||
ThisCategoryHasNoItems=This category does not contain any items.
|
||||
CategId=Tag/category id
|
||||
ParentCategory=Parent tag/category
|
||||
ParentCategoryID=ID of parent tag/category
|
||||
ParentCategoryLabel=Label of parent tag/category
|
||||
CatSupList=List of vendors tags/categories
|
||||
CatCusList=List of customers/prospects tags/categories
|
||||
|
||||
@ -42,6 +42,7 @@ CreditTransferStatistics=Credit transfer statistics
|
||||
Rejects=Rejects
|
||||
LastWithdrawalReceipt=Latest %s direct debit receipts
|
||||
MakeWithdrawRequest=Make a direct debit payment request
|
||||
MakeWithdrawRequestStripe=Make a direct debit payment request via Stripe
|
||||
MakeBankTransferOrder=Make a credit transfer request
|
||||
WithdrawRequestsDone=%s direct debit payment requests recorded
|
||||
BankTransferRequestsDone=%s credit transfer requests recorded
|
||||
|
||||
@ -169,6 +169,15 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') {
|
||||
|
||||
$message = 'refused';
|
||||
setEventMessages("PropalRefused", null, 'warnings');
|
||||
if (method_exists($object, 'call_trigger')) {
|
||||
//customer is not a user !?! so could we use same user as validation ?
|
||||
$user = new User($db);
|
||||
$user->fetch($object->user_valid_id);
|
||||
$result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
@ -434,8 +434,10 @@ class Stripe extends CommonObject
|
||||
|
||||
// list of payment method types
|
||||
$paymentmethodtypes = array("card");
|
||||
$descriptor = dol_trunc($tag, 10, 'right', 'UTF-8', 1);
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
$paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC())
|
||||
//$descriptor = preg_replace('/ref=[^:=]+/', '', $descriptor); // Clean ref
|
||||
}
|
||||
if (!empty($conf->global->STRIPE_KLARNA)) {
|
||||
$paymentmethodtypes[] = "klarna";
|
||||
@ -463,7 +465,8 @@ class Stripe extends CommonObject
|
||||
"currency" => $currency_code,
|
||||
"payment_method_types" => $paymentmethodtypes,
|
||||
"description" => $description,
|
||||
"statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
||||
"statement_descriptor_suffix" => $descriptor, // For card payment, 22 chars that appears on bank receipt (prefix into stripe setup + this suffix)
|
||||
"statement_descriptor" => $descriptor, // For SEPA, it will take only statement_descriptor, not statement_descriptor_suffix
|
||||
//"save_payment_method" => true,
|
||||
"setup_future_usage" => "on_session",
|
||||
"metadata" => $metadata
|
||||
@ -589,131 +592,6 @@ class Stripe extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Stripe SEPA of a company payment mode
|
||||
*
|
||||
* @param \Stripe\StripeCustomer $cu Object stripe customer.
|
||||
* @param CompanyPaymentMode $object Object companypaymentmode to check, or create on stripe (create on stripe also update the societe_rib table for current entity)
|
||||
* @param string $stripeacc ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
|
||||
* @param int $status Status (0=test, 1=live)
|
||||
* @param int $createifnotlinkedtostripe 1=Create the stripe sepa and the link if the sepa is not yet linked to a stripe sepa. Deprecated with new Stripe API and SCA.
|
||||
* @return \Stripe\PaymentMethod|null Stripe SEPA or null if not found
|
||||
*/
|
||||
public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $status = 0, $createifnotlinkedtostripe = 0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$sepa = null;
|
||||
|
||||
$sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa";
|
||||
$sql .= " WHERE sa.rowid = '".$this->db->escape($object->id)."'"; // We get record from ID, no need for filter on entity
|
||||
$sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement)
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($object->fk_soc);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$cardref = $obj->stripe_card_ref;
|
||||
dol_syslog(get_class($this)."::cardStripe cardref=".$cardref);
|
||||
if ($cardref) {
|
||||
try {
|
||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||
if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) {
|
||||
$sepa = $cu->sources->retrieve($cardref);
|
||||
} else {
|
||||
$sepa = \Stripe\PaymentMethod::retrieve($cardref);
|
||||
}
|
||||
} else {
|
||||
if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) {
|
||||
//$sepa = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
|
||||
$sepa = $cu->sources->retrieve($cardref);
|
||||
} else {
|
||||
//$sepa = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works
|
||||
$sepa = \Stripe\PaymentMethod::retrieve($cardref);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
}
|
||||
} elseif ($createifnotlinkedtostripe) {
|
||||
$iban = $obj->iban_prefix; //prefix ?
|
||||
$ipaddress = getUserRemoteIP();
|
||||
|
||||
$dataforcard = array(
|
||||
'type'=>'sepa_debit',
|
||||
"sepa_debit" => array('iban' => $iban),
|
||||
'currency' => 'eur',
|
||||
'usage' => 'reusable',
|
||||
'owner' => array(
|
||||
'name' => $soc->name,
|
||||
),
|
||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress)
|
||||
);
|
||||
|
||||
//$a = \Stripe\Stripe::getApiKey();
|
||||
//var_dump($a);var_dump($stripeacc);exit;
|
||||
try {
|
||||
dol_syslog("Try to create sepa_debit 0");
|
||||
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
}
|
||||
// Force to use the correct API key
|
||||
global $stripearrayofkeysbyenv;
|
||||
$stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key'];
|
||||
|
||||
dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard));
|
||||
$s = new \Stripe\StripeClient($stripeacc);
|
||||
$sepa = $s->sources->create($dataforcard);
|
||||
if (!$sepa) {
|
||||
$this->error = 'Creation of sepa_debit on Stripe has failed';
|
||||
} else {
|
||||
//association du client avec cette source de paimeent
|
||||
$cs = $cu->createSource(
|
||||
$cu->id,
|
||||
[
|
||||
'source' => $sepa->id,
|
||||
]
|
||||
);
|
||||
if (!$cs) {
|
||||
$this->error = 'Link SEPA <-> Customer failed';
|
||||
} else {
|
||||
dol_syslog("Try to create sepa_debit 3");
|
||||
// print json_encode($sepa);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',";
|
||||
$sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'";
|
||||
$sql .= " WHERE rowid = '".$this->db->escape($object->id)."'";
|
||||
$sql .= " AND type = 'ban'";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $sepa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Stripe payment intent. Create it with confirmnow=false
|
||||
* Warning. If a payment was tried and failed, a payment intent was created.
|
||||
@ -1012,6 +890,127 @@ class Stripe extends CommonObject
|
||||
return $card;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the Stripe SEPA of a company payment mode
|
||||
*
|
||||
* @param \Stripe\StripeCustomer $cu Object stripe customer.
|
||||
* @param CompanyPaymentMode $object Object companypaymentmode to check, or create on stripe (create on stripe also update the societe_rib table for current entity)
|
||||
* @param string $stripeacc ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
|
||||
* @param int $status Status (0=test, 1=live)
|
||||
* @param int $createifnotlinkedtostripe 1=Create the stripe sepa and the link if the sepa is not yet linked to a stripe sepa. Deprecated with new Stripe API and SCA.
|
||||
* @return \Stripe\PaymentMethod|null Stripe SEPA or null if not found
|
||||
*/
|
||||
public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $status = 0, $createifnotlinkedtostripe = 0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$sepa = null;
|
||||
|
||||
$sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa";
|
||||
$sql .= " WHERE sa.rowid = '".$this->db->escape($object->id)."'"; // We get record from ID, no need for filter on entity
|
||||
$sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement)
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($object->fk_soc);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$cardref = $obj->stripe_card_ref;
|
||||
dol_syslog(get_class($this)."::cardStripe cardref=".$cardref);
|
||||
if ($cardref) {
|
||||
try {
|
||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||
if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) {
|
||||
$sepa = $cu->sources->retrieve($cardref);
|
||||
} else {
|
||||
$sepa = \Stripe\PaymentMethod::retrieve($cardref);
|
||||
}
|
||||
} else {
|
||||
if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) {
|
||||
//$sepa = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
|
||||
$sepa = $cu->sources->retrieve($cardref);
|
||||
} else {
|
||||
//$sepa = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works
|
||||
$sepa = \Stripe\PaymentMethod::retrieve($cardref);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
}
|
||||
} elseif ($createifnotlinkedtostripe) {
|
||||
$iban = $obj->iban_prefix; //prefix ?
|
||||
$ipaddress = getUserRemoteIP();
|
||||
|
||||
$dataforcard = array(
|
||||
'type'=>'sepa_debit',
|
||||
"sepa_debit" => array('iban' => $iban),
|
||||
'currency' => 'eur',
|
||||
'usage' => 'reusable',
|
||||
'owner' => array(
|
||||
'name' => $soc->name,
|
||||
),
|
||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress)
|
||||
);
|
||||
|
||||
//$a = \Stripe\Stripe::getApiKey();
|
||||
//var_dump($a);var_dump($stripeacc);exit;
|
||||
try {
|
||||
dol_syslog("Try to create sepa_debit 0");
|
||||
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
}
|
||||
// Force to use the correct API key
|
||||
global $stripearrayofkeysbyenv;
|
||||
$stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key'];
|
||||
|
||||
dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard));
|
||||
$s = new \Stripe\StripeClient($stripeacc);
|
||||
$sepa = $s->sources->create($dataforcard);
|
||||
if (!$sepa) {
|
||||
$this->error = 'Creation of sepa_debit on Stripe has failed';
|
||||
} else {
|
||||
// association du client avec cette source de paimeent
|
||||
$cs = $cu->createSource($cu->id, array('source' => $sepa->id));
|
||||
if (!$cs) {
|
||||
$this->error = 'Link SEPA <-> Customer failed';
|
||||
} else {
|
||||
dol_syslog("Try to create sepa_debit 3");
|
||||
// print json_encode($sepa);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',";
|
||||
$sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'";
|
||||
$sql .= " WHERE rowid = '".$this->db->escape($object->id)."'";
|
||||
$sql .= " AND type = 'ban'";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $sepa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create charge.
|
||||
* This is called by page htdocs/stripe/payment.php and may be deprecated.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user