Skip to content

Commit

Permalink
Little debug of option WEBSITE_USE_WEBSITE_ACCOUNTS
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 5, 2018
1 parent 9842978 commit 5883899
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 89 deletions.
4 changes: 2 additions & 2 deletions htdocs/core/lib/company.lib.php
Expand Up @@ -234,8 +234,8 @@ function societe_prepare_head(Societe $object)
$head[$h][1] = $langs->trans("WebSiteAccounts");
$nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."website_account as n";
$sql.= " WHERE fk_soc = ".$object->id;
$sql.= " FROM ".MAIN_DB_PREFIX."societe_account as n";
$sql.= " WHERE fk_soc = ".$object->id.' AND fk_website > 0';
$resql=$db->query($sql);
if ($resql)
{
Expand Down
3 changes: 3 additions & 0 deletions htdocs/install/mysql/migration/7.0.0-8.0.0.sql
Expand Up @@ -84,6 +84,9 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE

-- For 8.0

DROP TABLE llx_website_account;
DROP TABLE llx_website_account_extrafields;

ALTER TABLE llx_paiementfourn ADD COLUMN fk_user_modif integer AFTER fk_user_author;

-- delete old permission no more used
Expand Down
3 changes: 2 additions & 1 deletion htdocs/install/mysql/tables/llx_societe_account.sql
Expand Up @@ -13,7 +13,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see http://www.gnu.org/licenses/.
--
-- Table to store accounts of thirdparties on websites
-- Table to store accounts of thirdparties on external websites (like on stripe field site = 'stripe')
-- or on local website (fk_website).

CREATE TABLE llx_societe_account(
-- BEGIN MODULEBUILDER FIELDS
Expand Down
29 changes: 0 additions & 29 deletions htdocs/install/mysql/tables/llx_website_account.key.sql

This file was deleted.

36 changes: 0 additions & 36 deletions htdocs/install/mysql/tables/llx_website_account.sql

This file was deleted.

2 changes: 1 addition & 1 deletion htdocs/societe/class/societeaccount.class.php
Expand Up @@ -334,7 +334,7 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la
$label.= '<b>' . $langs->trans('Login') . ':</b> ' . $this->ref;
//$label.= '<b>' . $langs->trans('WebSite') . ':</b> ' . $this->ref;

$url = dol_buildpath('/societe/societeaccount_card.php',1).'?id='.$this->id;
$url = dol_buildpath('/website/websiteaccount_card.php',1).'?id='.$this->id;

if ($option != 'nolink')
{
Expand Down
18 changes: 9 additions & 9 deletions htdocs/societe/website.php
Expand Up @@ -31,7 +31,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/websiteaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';

Expand All @@ -57,12 +57,12 @@

// Initialize technical objects
$object=new Societe($db);
$objectwebsiteaccount=new WebsiteAccount($db);
$objectwebsiteaccount=new SocieteAccount($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('websitethirdpartylist')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('websiteaccount');
$extralabels = $extrafields->fetch_name_optionals_label('thirdpartyaccount');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');

unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty
Expand Down Expand Up @@ -252,9 +252,9 @@
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql);
$sql.= " FROM ".MAIN_DB_PREFIX."website_account as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."websiteaccount_extrafields as ef on (t.rowid = ef.fk_object)";
if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_account as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)";
if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")";
else $sql.=" WHERE 1 = 1";
$sql.=" AND fk_soc = ".$object->id;
foreach($search as $key => $val)
Expand Down Expand Up @@ -335,9 +335,9 @@
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);

$topicmail="Information";
$modelmail="websiteaccount";
$objecttmp=new WebsiteAccount($db);
$trackid='websiteaccount'.$object->id;
$modelmail="societeaccount";
$objecttmp=new SocieteAccount($db);
$trackid='thi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';

if ($sall)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/website/class/website.class.php
Expand Up @@ -44,7 +44,7 @@ class Website extends CommonObject
*/
public $table_element = 'website';
/**
* @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var array Does website support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/**
Expand Down
8 changes: 3 additions & 5 deletions htdocs/website/lib/websiteaccount.lib.php
Expand Up @@ -22,17 +22,15 @@
*/

/**
* Prepare array of tabs for WebsiteAccount
* Prepare array of tabs for SocieteAccount
*
* @param WebsiteAccount $object WebsiteAccount
* @return array Array of tabs
* @param SocieteAccount $object SocieteAccount
* @return array Array of tabs
*/
function websiteaccountPrepareHead($object)
{
global $db, $langs, $conf;

$langs->load("monmodule@monmodule");

$h = 0;
$head = array();

Expand Down
10 changes: 5 additions & 5 deletions htdocs/website/websiteaccount_card.php
Expand Up @@ -16,9 +16,9 @@
*/

/**
* \file htdocs/Website/websiteaccount_card.php
* \file htdocs/website/websiteaccount_card.php
* \ingroup website
* \brief Page to create/edit/view websiteaccount
* \brief Page to create/edit/view thirdparty website account
*/

// Load Dolibarr environment
Expand All @@ -38,7 +38,7 @@

include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
include_once(DOL_DOCUMENT_ROOT.'/website/class/websiteaccount.class.php');
include_once(DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php');
include_once(DOL_DOCUMENT_ROOT.'/website/lib/websiteaccount.lib.php');

// Load translation files required by the page
Expand All @@ -53,12 +53,12 @@
$backtopage = GETPOST('backtopage', 'alpha');

// Initialize technical objects
$object=new WebsiteAccount($db);
$object=new SocieteAccount($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('websiteaccount');
$extralabels = $extrafields->fetch_name_optionals_label('societeaccount');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');

// Initialize array of search criterias
Expand Down

0 comments on commit 5883899

Please sign in to comment.