Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qual rename stancer module to stancerdolicloud #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Provides a way to make an online checkout of any membership dues, donation, customer invoice or customer order with the Stancer API.

<!--
![Screenshot stancer](img/screenshot_stancer.png?raw=true "Stancer"){imgmd}
![Screenshot stancerdolicloud](img/screenshot_stancerdolicloud.png?raw=true "Stancer"){imgmd}
-->

Other external modules are available on [Dolistore.com](https://www.dolistore.com).
Expand Down Expand Up @@ -66,11 +66,11 @@ Note: If this screen tell you that there is no "custom" directory, check that yo

### From a GIT repository

Clone the repository in ```$dolibarr_main_document_root_alt/stancer```
Clone the repository in ```$dolibarr_main_document_root_alt/stancerdolicloud```

```sh
cd ....../custom
git clone [email protected]:gitlogin/stancer.git stancer
git clone [email protected]:gitlogin/stancerdolicloud.git stancerdolicloud
```

-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 Lucas Marcouiller <lmarcouiller@dolicloud.com>
* Copyright (C) 2023 Alice Adminson <myemail@mycompany.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,9 +17,9 @@
*/

/**
* \file stancer/admin/about.php
* \ingroup stancer
* \brief About page of module Stancer.
* \file stancerdolicloud/admin/about.php
* \ingroup stancerdolicloud
* \brief About page of module StancerDolicloud.
*/

// Load Dolibarr environment
Expand Down Expand Up @@ -54,10 +54,10 @@
// Libraries
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once '../lib/stancer.lib.php';
require_once '../lib/stancerdolicloud.lib.php';

// Translations
$langs->loadLangs(array("errors", "admin", "stancer@stancer"));
$langs->loadLangs(array("errors", "admin", "stancerdolicloud@stancerdolicloud"));

// Access control
if (!$user->admin) {
Expand All @@ -83,21 +83,21 @@
$form = new Form($db);

$help_url = '';
$page_name = "StancerSetup";
$page_name = "StancerDolicloudSetup";

llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-stancer page-admin_about');
llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-stancerdolicloud page-admin_about');

// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';

print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');

// Configuration header
$head = stancerAdminPrepareHead();
$head = stancerDolicloudAdminPrepareHead();
print dol_get_fiche_head($head, 'about', $langs->trans($page_name), 0, '');

dol_include_once('/stancer/core/modules/modStancer.class.php');
$tmpmodule = new modStancer($db);
dol_include_once('/stancerdolicloud/core/modules/modStancerDolicloud.class.php');
$tmpmodule = new modStancerDolicloud($db);
print $tmpmodule->getDescLong();

// Page end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

/**
* \file stancer/admin/setup.php
* \ingroup stancer
* \brief Stancer setup page.
* \file stancerdolicloud/admin/setup.php
* \ingroup stancerdolicloud
* \brief StancerDolicloud setup page.
*/

// Load Dolibarr environment
Expand Down Expand Up @@ -55,13 +55,13 @@
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/geturl.lib.php";
require_once '../lib/stancer.lib.php';
require_once '../lib/stancerdolicloud.lib.php';

// Translations
$langs->loadLangs(array("admin", "stancer@stancer"));
$langs->loadLangs(array("admin", "stancerdolicloud@stancerdolicloud"));

// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('stancersetup', 'globalsetup'));
$hookmanager->initHooks(array('stancerdolicloudsetup', 'globalsetup'));

// Access control
if (!$user->admin) {
Expand Down Expand Up @@ -93,17 +93,17 @@

// Enter here all parameters in your setup page

$item = $formSetup->newItem('STANCER_LIVE')->setAsYesNo();
$item = $formSetup->newItem('STANCER_DOLICLOUD_LIVE')->setAsYesNo();

$item = $formSetup->newItem('STANCER_TEST_SECRET_API_KEY');
$item = $formSetup->newItem('STANCER_DOLICLOUD_TEST_SECRET_API_KEY');
$item->cssClass = 'minwidth500';
$item->helpText = $langs->transnoentities('STANCER_TEST_SECRET_API_KEY_HELP');
$item = $formSetup->newItem('STANCER_PROD_SECRET_API_KEY');
$item->helpText = $langs->transnoentities('STANCER_DOLICLOUD_TEST_SECRET_API_KEY_HELP');
$item = $formSetup->newItem('STANCER_DOLICLOUD_PROD_SECRET_API_KEY');
$item->cssClass = 'minwidth500';
$item->helpText = $langs->transnoentities('STANCER_PROD_SECRET_API_KEY_HELP');
$item->helpText = $langs->transnoentities('STANCER_DOLICLOUD_PROD_SECRET_API_KEY_HELP');


$item = $formSetup->newItem('STANCER_BANK_ACCOUNT_FOR_PAYMENTS')->setAsSelectBankAccount();
$item = $formSetup->newItem('STANCER_DOLICLOUD_BANK_ACCOUNT_FOR_PAYMENTS')->setAsSelectBankAccount();

$setupnotempty += count($formSetup->items);

Expand Down Expand Up @@ -145,7 +145,7 @@
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/stancer/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/stancerdolicloud/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
Expand All @@ -159,7 +159,7 @@
$module = new $classname($db);

if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=stancer-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=stancerdolicloud-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
Expand All @@ -173,7 +173,7 @@
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'STANCER_'.strtoupper($tmpobjectkey)."_ADDON";
$constforval = 'STANCER_DOLICLOUD_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'set') {
Expand All @@ -184,7 +184,7 @@
if ($ret > 0) {
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'STANCER_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
$constforval = 'STANCER_DOLICLOUD_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity);
}
Expand All @@ -194,7 +194,7 @@
// Set or unset default model
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'STANCER_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
$constforval = 'STANCER_DOLICLOUD_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
Expand All @@ -210,7 +210,7 @@
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'STANCER_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
$constforval = 'STANCER_DOLICLOUD_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
Expand All @@ -225,21 +225,21 @@
$form = new Form($db);

$help_url = '';
$page_name = "StancerSetup";
$page_name = "StancerDolicloudSetup";

llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-stancer page-admin');
llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-stancerdolicloud page-admin');

// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';

print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');

// Configuration header
$head = stancerAdminPrepareHead();
$head = stancerDolicloudAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "");

// Setup page goes here
echo '<span class="opacitymedium">'.$langs->trans("ModuleStancerDesc").'</span><br><br>';
echo '<span class="opacitymedium">'.$langs->trans("ModuleStancerDolicloudDesc").'</span><br><br>';


if ($action == 'edit') {
Expand All @@ -255,7 +255,7 @@
}


$moduledir = 'stancer';
$moduledir = 'stancerdolicloud';
$myTmpObjects = array();
// TODO Scan list of objects
$myTmpObjects['myobject'] = array('label'=>'MyObject', 'includerefgeneration'=>0, 'includedocgeneration'=>0, 'class'=>'MyObject');
Expand Down Expand Up @@ -324,7 +324,7 @@
print '</td>'."\n";

print '<td class="center">';
$constforvar = 'STANCER_'.strtoupper($myTmpObjectKey).'_ADDON';
$constforvar = 'STANCER_DOLICLOUD_'.strtoupper($myTmpObjectKey).'_ADDON';
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
Expand Down Expand Up @@ -467,7 +467,7 @@

// Default
print '<td class="center">';
$constforvar = 'STANCER_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
$constforvar = 'STANCER_DOLICLOUD_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
Expand Down
Loading
Loading